[Python-Dev] "Fixing" the new GIL

Kristján Valur Jónsson kristjan at ccpgames.com
Wed Mar 17 12:01:16 CET 2010

I could also point you at EVE online, a large scale IO machine based on stackless python.  Our game proxies (front end servers) handle 30.000 client connections each using tasklets.  The problem is coarse grained scheduling of IO and other tasks, same as with threads in regular Python.  We have found that adhering to FIFO scheduling provides good all round performance, particularly the variance of IO latency is very low.
As I‘v mentioned in another message, I am toying with the idea of adding another priority layer to the Stackless scheduler for IO tasks.  It´s not trivial though (requires me to do some stackless surgery) and the turnaround time to test new approaches in production for us is a bit high ☺


From: python-dev-bounces+kristjan=ccpgames.com at python.org [mailto:python-dev-bounces+kristjan=ccpgames.com at python.org] On Behalf Of Robert Hancock
Sent: 16. mars 2010 20:10
To: Peter Portante
Cc: David Beazley; python-dev at python.org
Subject: Re: [Python-Dev] "Fixing" the new GIL

The Linux kernel scheduler deals with two types of ratings and has a heuristic algorithm that rewards and penalizes on a rapid basis.  To determine the next thread it inspects the priority array to find the highest priority task that is runnable and then selects the first task in that priority.  This is a gross simplification of an extremely complex system, but it is not simply a simple queue.

To duplicate this exact type of scheduling in the interpreter would be a daunting task, but Dave's example illustrates that some system of reward and penalty can be beneficial.

Peter has brought up the point, both here and at the Open Space at Pycon, that before attempting a downsized version of the a priority thread scheduler that we should look at other programs that have had to deal with similar problems.

Peter, since you have dealt with the nitty-gritty of concurrency before, can you suggest some applications that could serve as models for research?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100317/75c31944/attachment.html>

More information about the Python-Dev mailing list