Use httperf for Server Benchmarking
When you're prototyping Web applications or just trying to test and tune your Web servers, one of the best tools you can start with is httperf.
The name probably gives it away, but httperf is a tool that generates workloads to test HTTP servers. It works with HTTP/1.0 and HTTP/1.1, as well as SSL if needed. It was written by David Mosberger for HP, and it is released under the GPLv2.
The tool has moved around a bit; it was initially hosted on SourceForge but now resides on Google Code. It's worth noting that httperf is fairly mature and not changing a lot at this point. The most recent release (0.9) is a few years old, but that shouldn't be a problem. Most Linux distros have httperf packaged already, so if you're on Debian, Ubuntu, Fedora, openSUSE and so on, you should just be able to grab it from the distribution repositories. If not, the tarball is on Google Code.
A couple of notes if you're going to be using httperf. First, don't point it at someone else's server. Performance testing other people's systems is usually frowned on. Second, run httperf on a different system from the ones you're profiling. Why? Because httperf can be a bit resource intensive and you don't want to be skewing the results by running it and your Web server on the same system.
The most basic use of httperf is just
httperf--server=servername. Note that the servername should be the domain without the preceding "http://"--just the server name.
After you run httperf, it will generate a report with information about the test. This includes the number of connections, rate of connections, request size, request rate, reply time/size and rate, and much more. You'll also get a list of errors, if any.
Naturally, httperf has many more options than just the
--server option. The
--wsess option tells
httperf the number of sessions to generate, the number of calls per session and how many seconds should separate each call. It's specified like this:
--wsess=25,10,5, where the first number is the number of sessions, the second number is the number of calls per session and the last is the spacing.
There's also a
--wsesslog option that allows you to provide an input file with the calls you want made during the session. See the
httperf man page for more on that.
--ssl option does what it says on the tin--you can use that to test HTTPS performance rather than HTTP. The
--timeout option also should be obvious--it tells
httperf how long to wait for a server response.
To get started with httperf, you might want to use Theodore Bullock's Quickstart Guide (PDF), which gives a thorough rundown of the options and some good examples.
It's not terribly difficult to get started with httperf, but it can be very useful. Give it a try next time you need to do any kind of performance testing on a Website or application.
Joe 'Zonker' Brockmeier is a freelance writer and editor with more than 10 years covering IT. Formerly the openSUSE Community Manager for Novell, Brockmeier has written for Linux Magazine, Sys Admin, Linux Pro Magazine, IBM developerWorks, Linux.com, CIO.com, Linux Weekly News, ZDNet, and many other publications. You can reach Zonker at email@example.com and follow him on Twitter.
Read more on "Open Source Software Spotlight" »