Program | Server server load is too heavy to affect the efficiency of the program is also very common, we need to test this. Here I take the current most common Apache server as an example.
The Apache server comes with a tool called AB (Apachebench), which is in the bin directory. Using this lightweight tool we can load test the server to see how the server behaves under heavy load. Apachebench can simulate a continuous online request for a particular URL while also emulating the same online request at the same point in time, so using apachebench can help us simulate actual line possible situations during site development, Use the simulated data as the basis for adjusting the server settings or programs.
Output at 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 http://www.domain.com/myapp.php
AB will issue 50 concurrent requests to the http://www.domain.com/myapp.php at the same time, a total of 1000 times.
The test results will probably be like this:
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 received
Connection Times (MS)
Min avg Max
connect:0 0 5
processing:111 427 550
total:111 427 555
Myapp.php the number of requests that can be processed per second is 113.71. Increase the number of requests to see if the server can handle greater pressure. You also need to adjust the maxclients,threadsperchild,maxthreadsperchild parameters of Apache based on your httpd.conf MPM module selection.
If you want more detailed information, go to www.apache.org for more in-depth documentation, including modules and third-party productivity tools. After modifying the httpd.conf, restart the Apache server and then use the AB test. You will see an increase or decrease in the number of requests per second.
Make a note of each parameter and finally choose the one that is optimal for efficiency.
To point out that, in addition to AB, there are many excellent server performance testing software. Also, if your server is not Apache, look for a test method yourself.
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.