[Twisted-Python] Using sqlalchemy in twisted.
eero.nevalainen at indagon.com
Thu Nov 12 08:44:12 EST 2009
Peter Cai wrote:
> If you Google "sqlalchemy twisted", you can see my post is on the top:
> I've been busy for a long time so I didn't considered this question
> anymore. But occasionally, I got some new ideas today.
> I was suggested to sandbox sqlalchemy into process contains a single thread.
> At that time, I thought it was just the same as using deferToThread
> and makes no scenes to have the overhead of IPC.
> But now I see the benefits.
> A single thread process makes it possible to use a sqlalchemy session
> as a cache. That would greatly reduce the chances to lookup database.
> This could not be done with deferToThread because it uses thread pool.
> So there shall be more than one session and the state of cached
> objects will conflict.
> But there are still one problem : how to transfer a sqlalchemy object
> between 2 process? Some kind of serialization and de-serialization is
> needed. Without test, it's too early to tell if it works.
Is there a reason why multiprocessing could not be used?
More information about the Twisted-Python