So I uncovered the Google Code wiki (<a href="http://code.google.com/p/stacklessexamples/wiki/StacklessExamples">http://code.google.com/p/stacklessexamples/wiki/StacklessExamples</a>) - it seems like a slightly newer version of the wiki on 
<a href="http://stackless.com">stackless.com</a>. Which should we be using?<br><br>Anyhow, on there I discovered basicWebserver.py which supposedly fires off a tasklet for each connection. I mean the code there looks right, but I&#39;m finding that it&#39;s still blocking on every request - meaning that if one request is running, no more requests can be served.
<br><br>I&#39;m also not sure I see any specific advantage to using stacklesssocket.py here - is that just an extra optimization to get some scheduling done in the socket code? Because it seems like the server (should) be managing most of this pretty well.
<br><br>But I think it will be a good starting point for the StacklessWSGIServer I have in mind. I&#39;ll keep poking at it.<br><br>Alec<br><br><div><span class="gmail_quote">On 4/6/07, <b class="gmail_sendername">Alec Flett
</b> &lt;<a href="mailto:alecf@flett.org">alecf@flett.org</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hey folks -<br>
I&#39;ve scoured the web, the wiki, and anywhere else I can think of. I&#39;m wondering if anyone has written a stackless-based WSGI-compliant http server.. <br><br>I&#39;ve got a bunch of WSGI apps and middleware that I currently run under mod_python with prefork apache. Apache is driving me nuts and I&#39;d like to switch to an asynchronous model. It&#39;s pretty CPU hungry stuff but I think I&#39;ve figured out a good way to break up the work. Stackless seems ideal for this -- just dispatch each http connection to a new tasklet. Plus stackless would allow me to easily share common work between the tasklets.
<br><br>(I looked at Twisted but since WSGI is pretty callstack-oriented, WSGI &amp; Twisted kind of a nasty combination)<br><br>I don&#39;t need anything special from the server itself beyond the WSGI capability because I&#39;m using formencode, selector, and other WSGI-based middleware that does all the work of your classic app server.
<br><br>I started down the road of building on the WSGIServer/WSGIRequestHandler stuff in wsgiref, (which is based on BaseHTTPServer) but as it started to get complicated I thought, surely someone has dealt with this stuff before?
<br><br>As an aside, this stuff will be eventually running on multi-core machines. Two cores today, and I&#39;m sure more tomorrow. One thought I had was to run one long-running stackless python for each core, and let lighttpd do the work. In that case, maybe what I really need is a fastcgi-wsgi gateway that&#39;s stackless friendly. Has anyone explored that avenue?
<br><br>But hey, if nobody else has done this stuff, I&#39;ll be happy to share my work....<br><span class="sg"><br>Alec
</span></blockquote></div><br>