[Stackless] Questions on the Evolution of Stackless

Andrew Francis andrewfr_ice at yahoo.com
Tue Feb 26 22:45:27 CET 2008


Hi Andreas:

> generators: cannot yield from a subfunction call.
> greenlets: can yield basically everywhere.
> stackless: adds cooperative (and uncooperative)
> scheduling. IMHO, generator based coroutines are
>quite limited by the fact that it's
> impossible to develop functions to do work. You can
> yield back some form ~ of say IO request to the
>outside, but you cannot encapsulate that
> functionality in a library for easy usage.

Thanks for the explanation. Jean-Paul Calderone gave a
nice example in the Twisted mailing list of what can't
be done with a generator.

> - -) Twisted is way more efficient for handling many
> connections than other models.

I don't doubt Twisted's efficiency. However it was the
feature richness and the desirability of having an
asynchronous I/O package for Stackless that made me
settle on Twisted.


> - -) Twisted is twisty. 

Well I think stuff like Stackless make Twisted merely
kinky. 

>I personally have no problems with Twisted, but I  do
>know that some relative good developers consider
>Twisted apps to painful to maintain. Especially,
>multiple experiences for me suggest that typical
>average programmers are not capable of doing
something
> "simple" as web development. 

For better or worse, most of the Twisted experiences
are in the context of Stackless. Here I can make
synchronous Twisted calls (my processor will control
blocking). 

Knowing what I know now and if I were *way* more
skilled, I could write a WS-BPEL implementation using
only Twisted. However it would be a brutal exercise.
This is because WS-BPEL has constructs that translate
into brutal control flow issues. Stackless Python's
concurrency model makes WS-BPEL very manageable. And
with Twisted, I don't have to sweat low level issues. 

On the other hand, these days I use Twisted to
implement servers and clients. I still use Twisted in
a relatively simple way and I get a lot done. I think
it is a case of understanding how to chain callbacks 

>So Twisted is not and will probably never become a
>mainstream solution.

Sigh.

> The answer seems to be advanced control structures,
> namely coroutines as a minimum.

I would concur. I use what the literature would
describe as a wrapper approach... I turn stuff like
server protocol request handlers into tasklets. This
is because the request handlers have to talk (albeit
via transitivity) to higher level tasklets. Without
turning the request handlers into tasklets, I would
block the reactor and grind the system to a halt. 

I feel I am doing is a bit off the beaten track. And I
am uncomfortable with my current approach. In the case
of Twisted/Stackless in regard to my work, I feel
there is a missing link, something that bridges
deferreds and channels.
 
> As for numbers, a quick and dirty test suggest that
> on my laptop, the wsgiref demoapp gives the
following >results:

Wow. I haven't benchmarked my WS-BPEL processor yet.
Getting the dog to bark has so far been my main
priority.

> Well, perhaps not for the big mainstream, but there
> is clearly a group of people who care about
>performance ;)

Andreas, thanks for your explanation and insights.

Cheers,
Andrew


      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping




More information about the Stackless mailing list