Simple threaded web-server based on BaseHTTPServer?

Mark Hammond mhammond at skippinet.com.au
Thu Jan 31 06:23:02 EST 2002


Thomas Weholt wrote:
> Can anybody show me how to create a threaded web-server based on
> BaseHTTPServer?

You almost certainly don't want that for the real world.  Having a 
thread per connection will not scale well at all.


> And if anybody has an opinion about it's ok performance wise to base a
> Threaded-webserver on BaseHTTPServer or go for Medusa? What does Medusa
> offer over the threaded BaseHTTPServer? Performance? Features? Is it
> possible to create a encrypted server using SSL with BaseHTTPServer?

Medusa offers scalability.  The main thread can handle a large number of 
connections, as no connection ever blocks the main thread.

It would make sense on multiple CPU machines to have a small thread-pool 
(generally one thread per processor), and each thread runs an asyncore 
loop.  Python's global lock should not get in the way too much here, as 
the socket IO operations release the lock.

Mark.




More information about the Python-list mailing list