[Stackless] irc threads

Kristján Valur Jónsson kristjan at ccpgames.com
Wed Jul 15 01:07:51 CEST 2009


Well, on Windows, one of the rules of efficient network programming is to not use select().
See:  http://tangentsoft.net/wskfaq/articles/io-strategies.html
and http://msdn.microsoft.com/en-us/magazine/dvdarchive/cc302334.aspx
select() is discouraged on windows except for compatibility reasons, since it works contrary to the internal IO scheduling mechanisms.

K

From: Larry Dickson [mailto:ldickson at cuttedge.com]
Sent: 14. júlí 2009 15:34
To: Kristján Valur Jónsson
Cc: Henning Diedrich; stackless at stackless.com
Subject: Re: [Stackless] irc threads

There seems to be a false assumption here: select does not "poll the sockets" (or anything else) and it is not inefficient. In fact, it blocks until one of  the events in question takes place, then reawakens a single process (e.g. main tasklet). This is as efficient as you can get, and "native facilities" are almost certainly just doing the same thing in a hidden place.

Larry Dickson
Cutting Edge Networked Storage

On 7/9/09, Kristján Valur Jónsson <kristjan at ccpgames.com<mailto:kristjan at ccpgames.com>> wrote:
StacklessIO is written in C++.  It uses native facilities to notify an internal event queue when an IO request has completed, instead of requiring the "main tasklet" to regularly poll the sockets using select() which is inefficient.  This aims to minimize latency and reduce overhead.  It can also use the async. notification facility of the python C api to wake up sleeping tasklets without requiring the main tasklet to poll the event queue.
It is also more 'complete' in its emulation of the native socket module, I think.
But performance tests by Richard on his module have still shown it to be very capable, and to scale better than threaded solutions like your irc server, so it may well be quite adequate for the task.

K

> -----Original Message-----
> From: Henning Diedrich [mailto:hd at authentic-internet.de<mailto:hd at authentic-internet.de>]
> Sent: 9. júlí 2009 14:02
> To: Kristján Valur Jónsson; stackless at stackless.com<mailto:stackless at stackless.com>
> Subject: Re: [Stackless] irc threads
>
>
>
> Kristján Valur Jónsson wrote:
> > Yes, stacklessIO is designed to do that for you, to provide a
> transparently tasklet-blocking replacement module for socket and
> others.
> > However, I hven't still managed to release it (although I do intend
> to as soon as I can) and it is at them moment Windows only, and likely
> to remain so for a bit.
> >
> > Meanwhile, there is Richard Tew's async socket implementation.
> >
> > K
> >
>
> Thanks for the clarification. What is the difference between
> stacklessIO
> and Richard's implementation? This question is probably naive but maybe
> some pointers are possible?
>
> Thanks,
> Henning


_______________________________________________
Stackless mailing list
Stackless at stackless.com<mailto:Stackless at stackless.com>
http://www.stackless.com/mailman/listinfo/stackless

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20090714/c812d445/attachment.htm>


More information about the Stackless mailing list