How to kill a SocketServer?

Donn Cave donn at u.washington.edu
Tue Apr 13 12:29:16 EDT 2004


In article <c5g4qc$hru$1 at news.service.uci.edu>,
 Josiah Carlson <jcarlson at uci.edu> wrote:

> > Since the whole application uses much CPU power, the performance (esp. the
> > reaction time) of an asynchronous server is too low.
> > 
> > We found out that a threading server is much the better choise for this, but
> > we'd need a way to stop a server and start it again (wich new parameters).
> 
> That is very interesting.
> 
> After doing some research into heavily multi-threaded servers in Python 
> a few years back, I discovered that for raw throughput, a properly 
> written async server could do far better than a threaded one.
> 
> If your request processing takes the most time, you may consider a 
> communication thread and a processing thread.
> 
> If your processing thread does a lot of waiting on a database or 
> something else, it may make sense to have one communication thread, and 
> a handful of database query threads.
> 
> What part of a request takes up the most time?

I wonder if you're making it more complicated than necessary.

The application uses a lot of CPU as it handles multiple
concurrent client connections.  That makes a pretty clear
case for some kind of parallel thread architecture, not
only to dispatch inputs promptly but also to take advantage
of commonly available SMP hardware.  As you acknowledge
above, the details of that architecture depend a lot on
what exactly they're doing - how many connections over
time, the nature of the request processing, etc.  But at
any rate, now they have a thread waiting in accept, and they
need to shake it loose.  My answer is `define a shutdown
request as part of the service protocol', but maybe you
would have a better idea.

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list