Today I finally sat down to remodel my HTTP stack/server from a forking model to a multithreaded model using the pthread library. Actually, this is my first project where I use POSIX threads, and I was delighted how easy it was to integrate them into my relatively well-designed program.
The server now works as follows: the "main" thread first creates a number of worker threads, and then accepts connections, puts them into a queue and then notifies the worker threads. The next worker thread that is ready takes the connection from the queue and handles the incoming requests. This is definitely a very simple design, which was also very easy to implement. The results can be found in
httpstack/branches/pthread in the SVN repository. As usual, comments are welcome.
The next thing is where I will move that project. One idea I had was to integrate a database connection pool, and in addition probably a simple object-relational mapper, then an HTTP management interface for the whole thing and then some CMS.
It seems to be cool to write webserver at the moment AK is writing one and also Mathias Eberle and me finished swebd which was the last homework of the UNIX course at university. Swebd is a simple webserver written in C which supports compression of t
Tracked: Jul 16, 19:00