wai, is it fast!

I've been playing around with the various haskell web frameworks lately. I've played with both snap and yesod but I just couldn't bring myself to plow through all of the documentation, great as it is. I've been taking a shining to to a more minimal approach with just warp and wai. This combination is a little less abstraction driven and a little more bare, which I like. Further, its incredibly fast.

I recently benchmarked a very trivial static page response with snap, wai, nginx and go's own webserving library. the results were roughly as follows:

  1. nginx: 13k+ responses/sec
  2. wai/warp: 12.5k responses/sec
  3. go: 8k responses/sec
  4. snap: 4k responses/sec
The test was run with ab -n 50000 -c 100 on a macbook pro running ubuntu linux. I must say i was impressed at wai/warp coming so close to nginx. Needless to say, any of these servers would be satisfactory for everyday use. The go sample server contained the least amount of code, literally just a few lines.

Below is the total code for the wai/warp server.


last update 2012-03-31