views:

679

answers:

7

I am interested in learning how to write extremely efficient network server software and I don't mind getting my hands dirty with pointers, sockets and threading. I'm talking a server being able to handle thousands of concurrent connections. There is not much processing for each client, but a little.

Do you know of any code examples for really efficient network servers?

Optionally points for small, well documented code that is cross-platform as well.

+1  A: 

This may not be exactly what you are looking for, but I briefly recall looking at Space Tyrant a few years back and thinking it sounded cool.

http://librenix.com/?inode=6240

Hope it helps!

Speedy
+1  A: 

Read this

http://www.evanmiller.org/lxr/http/source/

S.Lott
+4  A: 

You'll find a lot of good references and discussion about building highly scalable network servers on Dan Kegel's The C10K problem page.

Lance Richardson
A list of open-source server implementations using the various described approaches can be found near the bottom of the page.
Lance Richardson
It's a good page, been there before. But I still feel that the example part of the page is lacking, mostly in edge-triggered solutions. Hence, the question :)
Andrioid
+1  A: 

an ldap-server handles lots of transactions per second

http://de.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol

Peter Miehle
+1  A: 

You might consider studying things Dan Bernstein has written.

Definitely small (tiny, even) and cross platform, well documented would be debatable (user documentation yes, but if you're looking for comments in the code, they're few and far between).

For example, tinydns and dnscache are not threaded, but they can both answer thousands of queries per second.

Mark Johnson
+1 A very good answer, although I think cmeerw had a little more information in it. Thanks.
Andrioid
+1  A: 

Have a look at nginx, lighttpd and varnish for some popular high performance http servers.

BTW, I am currently working on combining edge-triggered epoll with multithreading (plus user-level swapcontext-style threads/fibers) - see http://svn.cmeerw.net/src/nginetd/trunk/ for some work-in-progress code (although this one is written in C++).

cmeerw
A: 

ACE is a wise choice.

robinhoo