Sorry I wasnt monitoring this thread. Didnt get a response right away and thought no one had responded.
I also think that theoretically there really would be not much of a change to using sqlalchemy (within pylons - pylons already creates a scopedsession object for every web request anyhow) in a co-routine framework such as gevent. Once I get a chance I would try it out and update this thread accordingly. Thanks for your inputs guys. On Jun 25, 5:33 pm, Yang Zhang <yanghates...@gmail.com> wrote: > On Fri, Jun 25, 2010 at 6:41 AM, Michael Bayer <mike...@zzzcomputing.com> > wrote: > > That's as deep as my thought goes on this and its all based on > > hypotheticals since I've never used twisted or greenlets or anything like > > that. Sorry if I'm totally off on howgevent/greenlets work, the linked > > documents didn't really make it clear how they work for someone who isn't > > already familiar. > > That's completely fair, the docs leave a lot to be desired. Think of > greenlets as an implementation of cooperative threading. In typical > threading, threads can first of all run in parallel, and the threading > is also preemptive, meaning context switches between threads can > happen at any time. With greenlets, "threads" are run in a single real > OS thread (no parallelism, only multiplexed concurrency), and context > switches between threads happen only voluntarily. > > Why is this useful? Because then you can write non-blocking code in a > blocking style. Non-blocking IO is useful for scalable systems > development, but event-driven programming (a la twisted) tends to be > more tedious and less natural than programming with blocking IO. Plus, > most existing code is written against blocking IO, but event-driven > programming makes those difficult to reuse. > > So to answer your first question of what things would look like in an > asynchronous world: with cooperative threads like greenlets, > everything would hopefully look identical. Embracing event-driven > style would indeed spell out significant changes to both sqlalchemy > and user code (and that's also not what I'm personally interested in > using). > > Upon closer inspection, it seems that changes might not even be > necessary for sqlalchemy, since one can globally set the asynchronous > callback for psycopg to hook directly intogevent. > > http://bitbucket.org/dvarrazzo/psycogreen/src/tip/gevent/psyco_gevent.py > -- > Yang Zhanghttp://yz.mit.edu/ -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.