Threaded server in python!?

Erno Kuusela erno-news at erno.iki.fi
Mon Jan 6 06:39:45 EST 2003


In article <av4u4r$v3c$06$1 at news.t-online.com>, "Achim Domma"
<achim.domma at syynx.de> writes:

| Hi,
| I would like to implement my own http chat server. As far as I know pythons
| threads are not very efficient due to the global interpreter lock. But
| applications like Zope, Webware, ... work fine and they use threads. Am I
| missing something or could somebody post some experiences (good ones and bad
| ones) with threaded, socked based python servers.

threads do not necessarily slow you down much, after importing the
thread module python only slows down by about 50% and if the number of
threads is not large, the resource overhead is not too bad either.

there are much better reasons to avoid threads than efficiency, such
as error proneness and debugging difficulties due to nondeterministic
scheduling.

worrying about the global interpreter lock suggests you may be
planning to use multiple processors. in that case you need to use a
python process per processor.

  -- erno




More information about the Python-list mailing list