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

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!s3g2000vbf.googlegroups.com!not-for-mail
From sturlamolden <sturlamolden@yahoo.no>
Newsgroups comp.lang.python
Subject Re: Questions about GIL and web services from a n00b
Date Sun, 17 Apr 2011 08:49:35 -0700 (PDT)
Organization http://groups.google.com
Lines 27
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>
NNTP-Posting-Host 46.212.104.145
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-Trace posting.google.com 1303055375 1497 127.0.0.1 (17 Apr 2011 15:49:35 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Sun, 17 Apr 2011 15:49:35 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info s3g2000vbf.googlegroups.com; posting-host=46.212.104.145; posting-account=jLVA4AoAAACnFl2D2gz1qNYFxA8AUnMb
User-Agent G2/1.0
X-HTTP-UserAgent Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; .NET4.0C),gzip(gfe)
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:3406

Show key headers only | 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