[Stackless] irc threads

Richard Tew richard.m.tew at gmail.com
Mon Jul 20 06:20:32 CEST 2009


On Mon, Jul 20, 2009 at 11:38 AM, Rach<rachie at oasiz.net> wrote:
> I have now tried various code snippets found throughout the web (inc
> stackless etc) but cannot get ANY python script to accept more than
> 1000(ish) concurrent connections (Windows).

It is entirely possible that this is related to your particular
Windows installation.  If you've only tried threading-based solutions,
then it is possible that the memory limitations are directly
responsible for this...

> I have seen details of "tasklets", "greenlets", but no code samples and/or
> anything that seems to work.

Umm, okay.   Well, as you are most likely aware, tasklets and
greenlets are primitives which relate to control flow.  Greenlets like
coroutines, and tasklets like microthreads.  In terms of scalable IO,
they are merely useful to wrap asynchronous IO in a way that doesn't
necessarily require layers of abstraction and boilerplate.  However
many connections you could support using them would be comparable to
however many you could support using other frameworks that adopt
asynchronous IO based solutions.  i.e. Twisted, asyncore, ...

> Does anyone know of something that WILL work, even a simple TCP server will
> do to test with. Links to working code samples would be greatly appreciated.
> I'd like to get a minimum of 3000 concurrent users ideally, and have the
> best possible solution for an IRC server using Python.
> Thanks for any help with this, I look forward to hearing from you!

If you wish to try an asynchronous IO solution assisted by the use of
Stackless, you might check out the networking example code in the
Stackless examples project:

  http://code.google.com/p/stacklessexamples/wiki/StacklessNetworking

The most directly relevant example might be the chat server:

  http://stacklessexamples.googlecode.com/svn/trunk/examples/networking/chatServer.py

In it, you can see standard socket usage transparently using the
'stacklesssocket' module and therefore asynchronous IO within the
microthreading.

Cheers,
Richard.




More information about the Stackless mailing list