[Haskell-cafe] code review? store server, 220loc.

Tim Newsham newsham at lava.net
Sun Aug 3 01:13:07 EDT 2008


Anyone interested in critiquing some code?  I'm looking for ideas
for making it faster and/or simpler:

    http://www.thenewsh.com/%7Enewsham/store/Server5.hs

This is an exercise to see how well a server in Haskell would perform.
My goals are roughly:
     - retargetability to other server types (ie. easy to
       replace request and response structures and business logic).
     - readability.
     - performance.

My measurements show that a simple dummy server (accept, forkio,
recv byte) handles roughly 7500 requests/connects per second,
the server/client that do real messages do about 4500 req and
connections per second.  If all requests are on the same connection
one after another it does about 13500 requests/second.  For
comparisons, a C ping-pong server does about 3600/second if
it has to fork for each new connection/request, and about 35000/sec
if its all on the same connection.  So it seems at least competitive
with a forking C server.  I havent tested threaded C servers.

Tim Newsham
http://www.thenewsh.com/~newsham/


More information about the Haskell-Cafe mailing list