[Twisted-Python] Twisted service kit

Christopher Armstrong radix at twistedmatrix.com
Fri Jun 13 12:31:09 EDT 2008


On Fri, Jun 13, 2008 at 5:04 PM, Johan Euphrosine <proppy at aminche.com> wrote:
> Hi,
>
> As part of a freelance job, I'm asked to glue twisted with other
> technologies together as a proof of concept of what be done (and how),
> in the context of a service communicating with C++ games.
>
> As it may be useful to someone else, I'm pushing the source here:
> http://proppy.aminche.com/hg/service-test/
>
> This is what the code features/shows so far:
> - JSON protocol over Int32StringReceived
> - C++ sample client using boost.asio and Json_Spirit
> - server and client OpenSSL endpoint
> - XMLRPC with credential checking using twisted.web and twisted.cred
> - packaging as a twisted plugin
> - connection round robbin using pydirector
> - inter node communication using twisted.spread perspective broker
> - db persistance using storm ORM

I'm glad to see people using Storm in Twisted apps, but I think
there's a problem with it. You're using the store directly with a
MySQL server, which will block. This is reasonable for things like
SQLite, but when you're using a multi-user database system like MySQL
or Postgres, queries can take an arbitrarily long time to complete,
which blocks your Twisted reactor. This is fine for some applications
where response time isn't critical, but I wouldn't want to use it for
a highly interactive application.

If SQLite isn't an option yet, then you can use the experimental
Storm/Twisted integration code in its Storm branch on Launchpad:

  https://code.launchpad.net/~therve/storm/twisted-integration

I'd love to hear how it works out if you try it.


-- 
Christopher Armstrong
International Man of Twistery
http://radix.twistedmatrix.com/
http://twistedmatrix.com/
http://canonical.com/


More information about the Twisted-Python mailing list