haskell httpd

Peter Simons simons at cryp.to
Tue Nov 4 23:58:48 EST 2003


S Alexander Jacobson writes:

 > Is there a reasonably efficient Haskell httpd
 > implementation around that uses poll/select?

There is a web server written in Haskell: HWS-WP
-- or "Haskell Web Server with Plug-ins". You'll
find it at:

    http://sourceforge.net/forum/forum.php?forum_id=253134
    http://cvs.sourceforge.net/viewcvs.py/haskell-libs/libs/hws-wp/

The following paper from Simon Marlow provides a
detailed description of the server's architecture:

    Writing High-Performance Server Applications
    in Haskell, Case Study: A Haskell Web Server

    http://www.haskell.org/~simonmar/bib.html

Note that HWS-WP does not use poll(2) directly.
Instead, it relies an Haskell's forkIO function to
spawn concurrent threads of execution. These are
_not_ necessarily system threads, though. GHC, for
instance, does implement IO threads with poll()
internally. Other compilers or run-time systems
may use other techniques.

I have experimented with direct poll()-based
scheduling in Haskell (using a CSP monad to
implement co-routines) and honestly didn't find it
to be worth the extra effort. Eventually, I threw
all the code away and just used forkIO, like
everybody else does.

Peter


P. S.: If you're interested in a poll()-based web
server written in C++, though, let me know. I have
some code I'm more than willing to share. The
server speaks HTTP/1.1 and can deliver static
pages. No dynamic content, though. But it _is_
fast. :-)



More information about the Haskell mailing list