Apache server load test

xiaoxiao2021-04-05  241

The server load is too large and the effect is also very common, and we need to test this. Here I am using the most commonly used Apache server.

The Apache server comes with a tool called AB (Apachebench), in the bin directory. Using this lightweight tool we can load testing on the server to see how the server is performed under heavy load. ApacheBench can simulate a continuous online request for a particular URL, and can also simulate the same online request, so use ApacheBench to help us simulate the like or on the line during website development, using the simulation Data is used as a basis for adjusting the server settings or programs.

Out of 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 simultaneously send 50 concurrent requests to http://www.domain.com/myapp.php, a total of 1000 times. Test results will probably be this: Server Software: Apache / 2.0.16Server Hostname: localhostServer Port: 80Document Path: /myapp.phpDocument Length: 1311 bytesConcurrency Level: 50Time taken for tests: 8.794 secondsComplete requests: 1000Failed requests: 0Total transferred: 1754000 bytesHTML transferred: 1311000 bytesRequests per second: 113.71Transfer rate: 199.45 kb / s receivedConnection Times (ms) min avg maxConnect: 0 0 5Processing: 111 427 550Total: 111 427 555 myapp.php number of requests processed per second is 113.71 . Add the number of requests to see if the server can handle greater pressure. You also need to adjust the Apache's MaxClients, Threadsperchild, MaxthReadsperChild, etc., based on the MPM module in your httpd.conf. If you want to get more detailed information, please review some more in-depth documents, including modules, and third-party tools to www.apache.org. After modifying httpd.conf, restart the Apache server and then use AB test. You will see the number of requests per second increase or decrease. Remember each parameter and finally select the configuration of optimum efficiency. It is to point out that in addition to AB, there are many excellent server performance test software. Also, if your server is not Apache, please find your test method.

转载请注明原文地址:https://www.9cbs.com/read-132098.html

New Post(0)