[prog] tachyon web server

Sam Watkins swatkins at fastmail.fm
Wed Apr 1 13:59:57 UTC 2009


> Hi, Sam. Usually, the code accepts new connections from a single parent 
> thread/process. Then it creates/forks a new thread/process to handle 
> each new connection.

> Some servers (like Apache) keep a bunch of active processes around to 
> handle new connections after they've been accepted, which improves 
> performance under heavy load. Maybe that's what you were thinking of.

ok, my server "tachyon" works similarly but uses epoll, a scheduler and
very lightweight "coroutines" instead of forking threads or processes.
Simon Tatham invented "coroutines in C" technique I am using. The server
can run from a single process but uses 2 or 3 processes to take
advantage of SMP. It can handle 20000 simultaneous connections in under
50Mb RAM. It out-performs apache2 and all of the other webservers I have
tested, although of course it doesn't have so many features.

You can try it out if you like: http://sam.nipl.net/tachyon/tachyon.tgz 
It is written in my version of C "brace", but there is a generated C
file and a Makefile which can be used to build it. I haven't coded a fix
for my "accept connections evenly between the processes" problem yet,
but it still works fine without having fixed that.

Sam


More information about the Programming mailing list