2014-10-19
Vegeta, a tool for web server stress testing
Standard stress testing tools like siege (or the venerable ab
, which
you shouldn't use) are all systems that do N
concurrent requests at once and see how your website stands up to
this. This model is a fine one for putting a consistent load on
your website for a stress test, but it's not actually representative
of how the real world acts. In the real world you generally don't
have, say, 50 clients all trying to repeatedly make and re-make one
request to you as fast as they can; instead you'll have 50 new
clients (and requests) show up every second.
(I wrote about this difference at length back in this old entry.)
Vegeta is a HTTP load and stress testing tool that I stumbled over at some point. What really attracted my attention is that it uses a 'N requests a second' model, instead of the concurrent request model. As a bonus it will also report not just average performance but also on outliers in the form of 90th and 99th percentile outliers. It's written in Go, which some of my readers may find annoying but which I rather like.
I gave it a try recently and, well, it works. It does what it says it does, which means that it's now become my default load and stress testing tool; 'N new requests a second' is a more realistic and thus interesting test than 'N concurrent requests' for my software (especially here, for obvious reasons).
(I may still do N concurrent requests tests as well, but it'll probably mostly be to see if there are issues that come up under some degree of consistent load and if I have any obvious concurrency race problems.)
Note that as with any HTTP stress tester, testing with high load levels may require a fast system (or systems) with plenty of CPUs, memory, and good networking if applicable. And as always you should validate that vegeta is actually delivering the degree of load that it should be, although this is actually reasonably easy to verify for a 'N new request per second' tester.
(Barring errors, N new requests a second over an M second test run
should result in N*M requests made and thus appearing in your server
logs. I suppose the next time I run a test with vegeta I should
verify this myself in my test environment. In my usage so far I
just took it on trust that vegeta was working right, which in
light of my ab
experience may be a little bit
optimistic.)