Server load testing for PHP program acceleration exploration

Source: Internet
Author: User
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. Application light

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. Apacheusers 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 http://www.domain.com/myapp.php


AB will send 50 concurrent requests to http://www.domain.com/myapp.php at the same time, 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


The number of requests that myapp. php can process per second is 113.71. 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 specific information, please go to www.apache.org to view more advanced documents, including modules and third-party efficiency-enhancing tools. After modifying httpd. conf, restart the Apache server and then use AB for testing. You will see the number of requests per second increase or decrease.

Write down the parameters each time, and finally select the configuration with the best efficiency.

Besides AB, we also have a lot of excellent server performance testing software. In addition, if your server is not Apache, please look for a test method on your own.

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.