Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do load testing of a PHP website from both ends

We have developed a website in PHP for small services. Before production, we have to do performance and load testing from server side (that is Apache) and from client side.

From Client side, I want to know what is the average response time overall and for each object etc. For back-end side (apache web-server), I want to know how many request (clients) it can handle before its performance start to degrade.

Is there any open source tool as we are on Linux platform, for this purpose. Or is there any website(s) available (freely) that can do all of these testing. We are more concerned about load testing where we want to request to our website from 1000 users at same time (for example) and want want to check client and server side different performance metrics.

like image 350
Hafiz Muhammad Shafiq Avatar asked Jul 03 '18 06:07

Hafiz Muhammad Shafiq


1 Answers

Since you are running Apache, you could use ab to stress test the server side of your application.

Apache HTTP server benchmarking tool

ab is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current Apache installation performs. This especially shows you how many requests per second your Apache installation is capable of serving.

Let's look an example:

ab -k -c 100 -n 10000 example.com/

By issuing the command above, you will be hitting http://example.com/ with 100 simultaneous connections until 10 thousand requests are met.

Here you have another tutorial how to use ab

Stress-Test Your PHP App With ApacheBench

Some other helpful tools are:

  1. Apache JMeter
  2. httperf

If you want a more in-detail view of your php objects and all that stuff I would suggest you to check blackfire. As I know they offer a free version for local testing and only one application. But I don't think that you need this one for now.

For your front end I would suggest you a set of tools that help you to see how your page performs in different devices:

  1. Lighthouse
  2. PageSpeed Insights
  3. Pingdom
like image 50
Edison Biba Avatar answered Nov 11 '22 00:11

Edison Biba