Search code examples
stress-testing

understanding concurrency in ab command


ab -n 1000 -c 10 http://localhost:8000/. How to understand -c here?

Is it 10 concurrent virtual user will hit 1000 request i.e. 10 user will invoke 100 request/sec to make it 1000 request as total or 10 concurrent virtual user will hit individual 1000 request (10 * 1000 = 10000) ?


Solution

  • The command ab -n 1000 -c 10 http://localhost:8000/ is for the Apache Benchmark (ab) tool, which is a load testing and benchmarking tool for HTTP servers. The parameters specified in this command can be understood as follows:

    • -n 1000: This sets the total number of requests to be sent during the benchmarking session. In this case, 1000 requests will be sent in total.
    • -c 10: This sets the level of concurrency, i.e., the number of simultaneous requests being sent to the server. In this case, 10 concurrent requests will be sent at a time.

    The command means that 10 concurrent virtual users will hit the server with a total of 1000 requests, not 10,000 requests. The 10 virtual users will keep sending requests concurrently until the total number of requests (1000) is reached. So, in this example, each of the 10 concurrent virtual users would send 100 requests (100 * 10 = 1000) to make it 1000 requests in total. Note that the rate of requests per second is not specified in this command; it depends on the performance of the server and network conditions.