Server load testing for PHP program accelerated exploration

Source: Internet
Author: User
Tags server port
It is also common that the server load is too large and the program efficiency is affected. We need to test this. Here I take the most common Apache server as an example.
The Apache server comes with a tool named AB (apacheworkflow) in the bin directory. With this lightweight tool, we can test the server load to see how the server performs under heavy loads. Apache can simulate continuous online requests for a specific URL, and simulate online requests with the same number of points at the same time, therefore, the use of apachetings can help us simulate the actual launch possible conditions during website development, and use the simulation data as the basis for adjusting server settings or programs.
Output in the command line:

./AB-n number_of_total_requests
-C number_of_simultaneous_requests
Http: // your_web_server/your_php_app.php
For example:

./AB-n 1000-c 50
At the same time, AB will send 50 concurrent requests to, with a total of requests.
The test results may be as follows:

Server Software: Apache/2.0.16
Server Hostname: localhost
Server Port: 80
Document Path:/myapp. php
Document Length: 1311 bytes
Concurrency Level: 50
Time taken for tests: 8.794 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 1754000 bytes
HTML transferred: 1311000 bytes
Requests per second: 113.71
Transfer rate: 199.45 kb/s converted Ed
Connection Times (MS)
Min avg max
Connect: 0 0 5
Processing: 111 427 550
Total: 111 427 555
Myapp. php processes 113.71 requests per second. Increase the number of requests to see if the server can handle more pressure. You also need to adjust parameters such as MaxClients, ThreadsPerChild, and MaxThreadsPerChild of Apache based on the MPM module in your httpd. conf file.
If you want more detailed information, go to for more in-depth documents, including modules and third-party efficiency improvement tools. After modifying httpd. conf, restart the Apache server and then use AB for testing. The number of requests per second increases or decreases.
Write down the parameters each time, and finally select the configuration with the best efficiency.
Besides AB, we also have many excellent server performance testing software. In addition, if your server is not Apache, please find a test method by yourself.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.