cost of creating threads

Remco Boerma remco at tomaatnet.nl
Sun Oct 3 02:46:07 CEST 2004


Hi,

Bryan Olson wrote:
> Remco Boerma wrote:
>  > In the documentation is a short comprehensive list of what server
>  > options for handling connections are usefull in what situations. .
>  > See chapter 15.1.2 on 
> http://www.cherrypy.org/static/html/tut/node17.html .
>  > While you have a tiny server, i would recommend a thread-pool of about 2
>  > to 3 threads. This at least cuts down the time needed for thread 
> creation.
> 
> What happens if all three threads are blocked, perhaps waiting
> for server_b, when a new request comes in?

I guess it would indeed wait until one of the first 3 threads has closed 
it's connection, or a timeout occurs. But you ought to test it, just to 
make sure. . With a little statistics usage, you would be able to create 
  new threads on the fly if many connections are established in a short 
time, releasing the threads when idle for x seconds.  . This would allow 
you to use more resources when needed, and releasing them when done.

I don't have any knowledge of pocket pc's, but is there any way you can 
use twisted? I've read/heared it's master using only a single thread. .

Cheers!



More information about the Python-list mailing list