'how to limit request per second in apache benchmark tools

I'm trying to stress test my Spring Boot application, but when I run the following command, what ab is doing is that trying to give out a result the the maximum my application could holds. But what I need is to check whether my application could hold at a specific request per second.

ab -p req.json -T application/json -k -c 1000 -n 500000 http://myapp.com/customerTrack/v1/send

The request per second given from above command is 4000, but actually, a lot of records are buffered in my application which means it can't hold that much rps. Could anyone tell me how to set a specific request per second in ab tools? Thanks!



Solution 1:[1]

I don't think you can get what you want from ab. There are a lot of other tools out there.

Here's a simple one that might do exactly what you want.

https://github.com/rakyll/hey

For rate limiting to 100 requests per second the below command should work.

hey -D req.json -T application/json -c 1000 -q 100 -n 500000 http://myapp.com/customerTrack/v1/send

Solution 2:[2]

Apache Bench is single threaded program that can only take advantage of one processor on your client’s machine. In extreme conditions, the tool could misrepresent results if the parameters of your test exceed the capabilities of the environment the tool is running in. Accorading to your description, the rps has already reach your hardware limitation.

A lot of records are buffered in my application which means it can't hold that much rps

It is very hard to control request per second in single machine. You can find better performacne testing tools from here HTTP(S) Benchmark Tools

If you have budget you can try goad, which is an AWS Lambda powered, highly distributed, load testing tool built in Go for the 2016 Gopher Gala. Goad allows you to load test your websites from all over the world whilst costing you the tiniest fractions of a penny by using AWS Lambda in multiple regions simultaneously.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jazzepi
Solution 2 howie