[Twisted-Python] Twisted service kit

Johan Euphrosine proppy at aminche.com
Fri Jun 13 12:56:46 EDT 2008


On Fri, 2008-06-13 at 17:31 +0100, Christopher Armstrong wrote:
> 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.
>

Thanks for the quick feedback,

At changeset 130:
http://proppy.aminche.com/hg/service-test/rev/9dac70808c34

I switched from sqllite to mysql, because I wasn't able to use
deferToThread with sqllite, for potentially blocking request:

http://proppy.aminche.com/hg/service-test/rev/b77a2c9a1ded

sqlite3.ProgrammingError: SQLite objects created in a thread can only be
used in that same thread.The object was created in thread id -1210218304
and this is thread id -1215493232

I took a look at storm/twisted integration, (I stoled the threading and
the inlineCallback tricks from it).

I will be definitely looking forward using it, for tighter storm/twisted
integration.
-- 
Johan Euphrosine <proppy at aminche.com>





More information about the Twisted-Python mailing list