[Twisted-Python] SQLAlchemy and Twisted

Phil Mayers p.mayers at imperial.ac.uk
Sun May 9 03:45:18 MDT 2010


On 05/09/2010 07:07 AM, Daniel Griffin wrote:
> If you let SQLAlchemy block twisted would there be any impact besides
> performance?

Depends how long it blocks for, and what else your process is doing.

With the reactor blocked:

  * no socket reads or accepts can be done
  * no callLater or LoopingCall can be scheduled

...and so on.

If you've only got a small number of clients and no time-based 
scheduling and you're only blocking for a short time (tens or hundreds 
of milliseconds, say) it may be tolerable.

If the server has a lot of clients, or needs to accept new ones in a 
timely fashion, or has time-based work to do, and your blocking might go 
on for a while, it's probably not tolerable.

I'd avoid it personally (but then I'm utterly unconvinced by ORMs) and 
stick to using SA in a thread as your SQL query layer.




More information about the Twisted-Python mailing list