Apache Bench
– 5 Minutes for realistic test
– 1/10/50/100/200/300/400/500/800/1000 Concurrent Users
– latency, error rate, success rate, response time

# this does 1000 requests to the URL. No problems here.
ab -n 1000 http://my-test-service.com

# this always does requests to the URL for 60 seconds. WRONG
ab -t 60 http://my-test-service.com

If you type ab without arguments you get a basic list of options including..

-t timelimit Seconds to max. wait for responses

Easy enough. What else could one possibly need to know to use this.

The man description of this option has a bit more info

-t timelimit
Maximum number of seconds to spend for benchmarking. This implies
a -n 50000 internally. Use this to benchmark the server within a fixed total
amount of time. Per default there is no timelimit.

References

1. http://www.pinkbike.com/u/radek/blog/Apache-Bench-you-probably-are-using-the-t-timelimit-option-incor.html

Apache Bench

1. -t Option
Setting -t automatically limits the total number of requests to 50k.
This means the test will stop when either 50k requests are reached or the defined time – whichever comes first!

ab -t 60 URL
If your test server answers 50k requests in say 5 seconds, then that is when Apache Bench will stop as well.

2. Parameter Order
this is significant. Always use -t BEFORE -n.
Otherwise apache bench sets the maximum requests to 50k!

Real example:

ab -k -c 10 -t 60 -n 100000000 -s 15 http://localhost/helloworld.htm
concurrency: 10
time for test: 60s
timeout: 15 seconds (30 seconds it kind of too high)
requests: 100million

i.e. in this case, you’ll likely get what you want. 10 concurrent users for 60 seconds.

http://www.pinkbike.com/u/radek/blog/Apache-Bench-you-probably-are-using-the-t-timelimit-option-incor.html

Charting

Graphing ApacheBench Results Using GnuPlot

About Gugulethu Ncube

IT enthusiast getting things done.