Questions about GIL and web services from a n00b

Chris H chris.humphres at windsorcircle.com
Fri Apr 15 13:09:49 EDT 2011


On 4/15/11 1:03 PM, Tim Wintle wrote:
> On Fri, 2011-04-15 at 12:33 -0400, Chris H wrote:
>> 1. Are you sure you want to use python because threading is not good
>> due to the Global Lock (GIL)?  Is this really an issue for
>> multi-threaded web services as seems to be indicated by the articles
>> from a Google search?  If not, how do you avoid this issue in a
>> multi-threaded process to take advantage of all the CPU cores
>> available?
> Is the limiting factor CPU?
>
> If it isn't (i.e. you're blocking on IO to/from a web service) then the
> GIL won't get in your way.
>
> If it is, then run as many parallel *processes* as you have cores/CPUs
> (assuming you're designing an application that can have multiple
> instances running in parallel so that you can run over multiple servers
> anyway).
>
> Tim Wintle

Great question.  At this point, there isn't a limiting factor, but yes 
the concern is around CPU in the future with lots of threads handling 
many simultaneous transactions.

Chris



More information about the Python-list mailing list