Multi-threaded web-server design issues

John E. Barham jbarham@o...
Mon, 30 Jul 2001 16:20:00 -0700

---------------------- multipart/alternative attachment
Hi all,

I'm trying to build a multi-threaded Web-server using Medusa's http_server.
(I need threads because our Web app. has some long-lived CGI scripts w/
heavy database access.) I based the initial design on the example HTTP
server from the code in the thread dir. of the Medusa
distro. However, that code obviously hasn't been touched in a while (I had
to change it to use the "new" http_request.split_uri(), used the standard
Queue module etc. etc.) so am wondering if there's a better approach. In
particular, to simplify things, I'm thinking about creating a separate
output queue (instead of the select_trigger stuff which has been giving me
weird errors) where all of the CGI worker threads would put their output
when they were finished. A separate response handling thread would then
pull the responses off this queue and feed them back to Medusa. Is this a
good approach?

Also, from what I can see from the code, the only http_request method that
isn't thread-safe is done(). Is this correct? That would mean that each
CGI thread could safely manipulate the request object itself, leaving the
response-handling queue to (serially) invoke done().

Thanks in advance for any feedback.


John E. Barham
Senior Software Developer

Phone: (604) 434-1321
Fax: (604) 430-1419

Octopus Wireless Inc.
5317 Lane Street
Burnaby, BC
V5H 2H4

---------------------- multipart/alternative attachment
An HTML attachment was scrubbed...

---------------------- multipart/alternative attachment--