Simple thread pools

Jeremy Jones zanesdad at bellsouth.net
Fri Nov 5 07:40:59 EST 2004


Jacob Friis wrote:

>>> I'm setting NUM_FEEDERS to 1000.
>>> Is that crazy?
>>
>>
>> Not crazy, but foolish.  Thread scheduling in Python reduces performance
>> beyond a few dozen threads.  If you are doing system calls (socket.recv,
>> file.read, etc.), your performance will be poor.
>
>
> Is there no way via Python to download say 1000 files simultaneously?
>
> - Jacob

Not to question whether you need to do this or not, but are you sure you 
need to do this?  Assuming you really really do, you may want to check 
out either asyn(core|chat) in the Python standard library or Twisted.  
I've only piddled with Twisted, and that only on the server end and 
never have done anything with the async things in the std lib, but they 
may do what you want them to do.


Jeremy Jones



More information about the Python-list mailing list