Questions about GIL and web services from a n00b

Aahz aahz at pythoncraft.com
Sat Apr 16 10:44:48 EDT 2011


In article <e6008cc8-50f0-4d78-be78-ec6e73b974e9 at 22g2000prx.googlegroups.com>,
Raymond Hettinger  <python at rcn.com> wrote:
>
>Threading is really only an answer if you need to share data between
>threads, if you only have limited scaling needs, and are I/O bound
>rather than CPU bound

Threads are also useful for user interaction (i.e. GUI apps).  

I think that "limited scaling" needs to be defined, too; CherryPy
performs pretty well, and the blocking model does simplify development.

One problem that my company has run into with threading is that it's not
always obvious where you'll hit GIL blocks.  For example, one would
think that pickle.loads() releases the GIL, but it doesn't; you need to
use pickle.load() (and cStringIO if you want to do it in memory).
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"At Resolver we've found it useful to short-circuit any doubt and just        
refer to comments in code as 'lies'. :-)"
--Michael Foord paraphrases Christian Muirhead on python-dev, 2009-03-22



More information about the Python-list mailing list