Questions about GIL and web services from a n00b

sturlamolden sturlamolden at yahoo.no
Sun Apr 17 16:37:01 CEST 2011


On Apr 15, 6:33 pm, Chris H <chris.humph... at windsorcircle.com> 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?


First, if you are stupid enough to to compute-bound work in Python,
without using a library, you have worse problems than the GIL. How
incompetent would you need to be to write multi-threaded matrix
multiplication or FFTs in pure Python, and blame the GIL for
lack for performance?

Second, if you think "advantage of all the CPU cores available"
will make difference for an I/O bound webservice, you're living
in cloud cookoo land. How on earth will multiple CPU cores
give you or your clients a faster network connection? The network
connection is likely to saturate long before you're burning the
CPU.

Sturla



More information about the Python-list mailing list