Monday, 25 June 2012

Linux C forking, threading, iterative and polling server...

Recently Linux Journal published a really great article by Martin Kalin about server concurrency. For the first time I was able to read about and see the code (all in c) for all the different server types without hours of searching Google with often fruitless results...

The article can be found at:

Martin's homepage:

You can also find a very detailed socket programming guide called "Beej's Guide to Network Programming" at:

I also did a few abusive rough no meaning benchmarks on the servers, I tried to do 50K requests as fast as my local system would allow, the results:

Total of 18631 requests completed in 6.33 seconds - second run completed without error...

Total of 47408 requests completed in 6.34 seconds - second run completed without error...

Threading server:
Total of 15102 requests completed in 3.23 seconds - first run broke the server with a  "Bad file descriptor" error

Total of 49175 requests completed - the first 50K broke the server, second run just outputs "Bad file descriptor"

 I would personally go for the Iterative server, it's simple and works a charm! Thank you to Martin for contributing the article!

No comments:

Post a Comment