I know I can use "-c" switch in ab to simulate a certain number of concurrent connections. Is there a way in which I could use "ab" to simulate 100 new clients every second visiting my website or getting a file? I would like to know how my server will behave under such a load.


I'm not sure you can do that with ab.

For that purpose I use JMeter with allow you to inject load on server in a more customizable way. You can give it a try.


I'd also recommend looking into jmeter as the results you get from ab aren't usually terribly useful. The tool is just too simple to be able to create a realistic workload for your server. Sometimes it's all you need (if you're not looking at the webserver so much as what happens system-wide during heavy load, for instance) but it really doesn't do a whole heck of a lot.

I'd also second the notion that you can't really accomplish this easily with ab. The closest you can get is something like:

for x in $(seq 1 10); do
ab -c 100 -n 100 http://localhost/ &
sleep 1
done > /tmp/abOutput.txt

Which will kick off a new ab instance every second, telling it to immediately create 100 client connections.

This answer is kind of stepping outside of ab by putting some of the logic in bash and the output is kind of harder to read, but it's better than nothing. Anything more complicated than this and I'd strongly suggest looking at jMeter.


If you are a bit familiar with Python, perhaps you could give Locust a try. With Locust, you need to create a Python script containing all the URLs that you need to check. You can also launch POST requests and post data to the server. When done, launch Locust's web interface (or simply use the command line interface) and specify number of users to simulate. The web interface presents real-time updates nicely.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.