As a back-end engineers, in addition to achieve business needs to consider it is to write their own services, whether in large concurrent normal operation. However, in general the development of the situation, not so much concurrency allows you to test, then how to do it?
At this time, we can use the apache stress test tools, apache bench referred ab.
Introduction
ab is the stress testing tool that comes with apache, ab is an abbreviation for apache bench commands.
After installing apache, you can be found in the bin below and then ab.exe apache load stress testing.
ab command creates multiple concurrent threads access, multiple visitors simultaneously to simulate a URL address to access. Its goal is to test based on the URL, so that both can be used to load stress testing apache can also test nginx, pressure lighthttp, tomcat, IIS and other Web servers.
ab command issued computers require very low load, it neither occupy high CPU, it will not take up a lot of memory. But also use their own tests need to pay attention, otherwise too much time on load. May cause the target server resource depletion, severe and even lead to crashes.
Simple to use
ab stress test tool is easy to use, single command.
Example: ab -n 200000 -c 20000 http://192.168.1.179/ >> d: 1.html # 20000 represent each concurrent requests, request a total of 200 000, and outputs the result to the specified file.
Results of the:
The results of parameters
Parameter Description:
Document Length: 315 bytes HTTP response data length of the body
Time taken for tests: 0.914 seconds all these requests time it takes to complete the process
Complete requests: 800 requests Completions
Failed requests: 0 Failed Requests
Total transferred: 393600 bytes The total amount of network transmission
HTML transferred: 252000 bytes HTML content over the
Requests per second: 875.22 [# / sec] (mean) Throughput - the number of requests per second
Time per request: 914.052 [ms] (mean) server receives the request, the page response time it takes to
Time per request: 1.143 [ms] (mean, across all concurrent requests) the average elapsed time for each request concurrent
Transfer rate: 420.52 [Kbytes / sec] received an average of traffic on the network per second, can help rule out whether an extended response time problems lead to too much network traffic
Consume time on the network of decomposition:
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 0.5 1 3
Processing: 245 534 125.2 570 682
Waiting: 11 386 189.1 409 669
Total: 246 535 125.0 571 684
The response of the entire scene all requests. Each request in the scene has a response time
50% of the user response time less than 571 ms
80% of the user response time less than 652 ms
The maximum response time less than 684 ms