I was discussing an embedded HTTP server I've written with a friend of mine yesterday. I've written it simply to serve local pages for an application I'm working. One cool thing about it is that it is completely asynchronous - spawning no threads yet able to service multiple requests simultaneously.
Now my friend, who is a really smart guy, wanted to compare the performance of my server with Apache httpd. The idea got me quite excited too - after all my server is completely asynchronous! Maybe it could compete with Apache when serving simple pages!
The trouble was, I had no idea how to benchmark the servers. So my good buddy (did I mention he's a smart chap?) pointed out that every Apache httpd installation comes with a neat little utility called
ab (Apache Benchmark)!
ab is a neat little program that is both simple and very useful. You can run it like this:
ab -n 2000 -c 50 http://localhost/somepage.htm
which will run 2000 connections in total with 50 simultaneous connections and give you a detailed list of relevant statistics.
So...how did my server do? The most relevant statistic for this comparison is probably
"Requests per second". My tiny server responded with an average of
550 rps.
Apache responded with
1800 rps!
Hats off to the folks at Apache - they left me eating their dust!
UPDATE: 2009-06-30: Not so fast! Check out some more findings in
my next post. Do I beat Apache after all?