Simple thread pools
Josiah Carlson
jcarlson at uci.edu
Thu Nov 4 17:34:48 EST 2004
Jacob Friis <lists at debpro.webcom.dk> wrote:
>
> I have built a script inspired by a post on Speno's Pythonic Avocado:
> http://www.pycs.net/users/0000231/weblog/2004/01/04.html#P10
>
> 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.
> Are there a better solution?
Fewer threads. Try running at 10-30. If you are finding that you
aren't able to handle the load with those threads, then your
processor/disk/etc isn't fast enough to handle the load.
- Josiah
More information about the Python-list
mailing list