From 1d9b1aa5357238728dbc04a53fd62ac19b698e06 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 20 Oct 2010 05:25:50 -0400 Subject: [PATCH] Reduce ThreadManager default worker_thread to 2. --- pysawsim/manager/thread.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pysawsim/manager/thread.py b/pysawsim/manager/thread.py index 95cae0f..289b06c 100644 --- a/pysawsim/manager/thread.py +++ b/pysawsim/manager/thread.py @@ -74,8 +74,20 @@ class ThreadManager (JobManager): , , , , , , , , ] >>> m.teardown() + + Note that Python's Global Interpreter Lock (GIL) currently limits + threads to a single core. See the following discussions: + + * http://smoothspan.wordpress.com/2007/09/14/guido-is-right-to-leave-the-gil-in-python-not-for-multicore-but-for-utility-computing/ + * http://docs.python.org/faq/library#id18 + * http://www.artima.com/weblogs/viewpost.jsp?thread=214235 + * http://www.snaplogic.com/blog/?p=94 + * http://stackoverflow.com/questions/31340/ + + Increasing `worker_pool` will only help you get around IO blockin + at the cost increased time-slicing overhead. """ - def __init__(self, worker_pool=5): + def __init__(self, worker_pool=2): super(ThreadManager, self).__init__() self._blocked = [] self._spawn_queue = Queue() -- 2.26.2