[Stackless] Stackless / Networking / Distributed Server
Lloyd Weehuizen
lloyd at fusion.net.nz
Tue Feb 20 10:55:28 CET 2007
Hey Marcus
On 20/02/2007, at 7:46 PM, Marcus wrote:
> 1. Receive client request (e.g. Login)
> 2. Server "frontend" begins handling message
> 3. During handling, server frontend would need to notify and
> communicate
> with other server nodes; procedural-style programming would be most
> straightforward for that type of procedure
> 4. Send response to client
>
> Is stackless the right tool for the job? I know Eve Online has used it
> (and that's how I found Stackless in the first place), but after
> searching it appears that Stackless doesn't work well with networking
> right now (monkeypatching excepted); I've seen quite a bit of
> discussion
> about Stackless with networking and blocking issues, but I haven't
> been
> able to find what peoples' solutions were.
>
I think stackless would be a great tool for this job. As you say
writing in a procedural manor would greatly help the development and
stackless excels at doing just that.
You're correct that there's no direct route to take as stackless
doesn't natively solve your blocking issues however with a day or
twos work developing a framework you'll be up and running with no
problems at all.
I don't have much experience with Twisted myself, so can't comment
there. The way I got round the issue was to write a simple RPC
framework.
Whenever I do an call to a remote server, I use a special Proxy
class, that wraps the call, serialises all the parameters into a data
stream and sends the data to the socket, at this point I block on a
stackless channel and the calling tasklet is suspended. Other
tasklets are then free to run and one of the these tasklets processes
all incoming data, when it gets a response for a rpc request
( they're all tagged with unique ids ) it simply looks the request up
in a table and wakes the correct tasklet, which deserialises the
remote functions return value and returns it like a normal function.
In this way the caller doesn't have to do anything out of the
ordinary when calling remote functions, all code follows the standard
procedural approach with the exception of creating a proxy object and
specifying which node in the cluster the call should go to.
Hope this helps,
Lloyd
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless
More information about the Stackless
mailing list