Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing POST data used by Apache Bench per iteration

Tags:

I'm using ab to do some load testing, and it's important that the supplied querystring (or POST) parameters change between requests.

I.e. I need to make requests to URLs like:

http://127.0.0.1:9080/meth?param=0
http://127.0.0.1:9080/meth?param=1
http://127.0.0.1:9080/meth?param=2
...

to properly exercise the application.

ab seems to only read the supplied POST data file once, at startup, so changing its content during the test run is not an option.

Any suggestions?

like image 716
James Brady Avatar asked Apr 08 '10 19:04

James Brady


2 Answers

You're going to need to use a more full-featured benchmarking tool like jMeter for this.

like image 146
ceejayoz Avatar answered Sep 18 '22 22:09

ceejayoz


Add my recommendation for jMeter...it works very well!

You could also create a script that creates a second script with something like:

ab -n 1 -c 1 'http://yoursever.com/method?param=0' & ab -n 1 -c 1 'http://yoursever.com/method?param=1' & ab -n 1 -c 1 'http://yoursever.com/method?param=2' & ab -n 1 -c 1 'http://yoursever.com/method?param=3' & ab -n 1 -c 1 'http://yoursever.com/method?param=4' &

But that's only really useful if you're trying to simulate load and observe your server. The actual benchmarks will have to be collated if you want to check ab performance. At that point I'd just use jMeter. For my use, I just need to simulate load and the ab processes are light enough that running 100 like this is no problem.

like image 45
extraplanetary Avatar answered Sep 17 '22 22:09

extraplanetary