Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #3406

Re: Questions about GIL and web services from a n00b

From sturlamolden <sturlamolden@yahoo.no>
Newsgroups comp.lang.python
Subject Re: Questions about GIL and web services from a n00b
Date 2011-04-17 08:49 -0700
Organization http://groups.google.com
Message-ID <f016af71-e70c-49c2-92b2-0d7383e173c4@s3g2000vbf.googlegroups.com> (permalink)
References <4DA8734C.1080706@WindsorCircle.com> <BANLkTikP03hkFPFz6diSpDgE8hQ5ZCWE2A@mail.gmail.com> <mailman.463.1303053332.9059.python-list@python.org>

Show all headers | View raw


On Apr 17, 5:15 pm, Ian <hobso...@gmail.com> wrote:

> > 5) Even in CPython, I/O-bound processes are not slowed significantly
> > by the GIL.  It's really CPU-bound processes that are.
>
> Its ONLY when you have two or more CPU bound threads that you may have
> issues.

And when you have a CPU bound thread, it's time to find the offending
bottleneck and analyse the issue.

Often it will be a bad choise of algorithm, for example one that is
O(N**2) instead of O(N log N). If that is the case, it is time to
recode.

If algoritmic complexity is not the problem, it is time to remember
that Python gives us a 200x speed penalty over C. Moving the
offending
code to a C library might give a sufficent speed boost.

If even that does not help, we could pick a library that uses
multi-threading internally, or we could release the GIL and use
multiple threads from Python. And if the library is not thread-safe,
it is time to use multiprocessing.


Sturla

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar


Thread

Re: Questions about GIL and web services from a n00b Ian <hobson42@gmail.com> - 2011-04-17 16:15 +0100
  Re: Questions about GIL and web services from a n00b sturlamolden <sturlamolden@yahoo.no> - 2011-04-17 08:49 -0700

csiph-web