[PonyORM-list] ponyorm async
Alexey Malashkevich
alexeymalashkevich at gmail.com
Thu Jul 10 18:37:07 UTC 2014
Hi!
Whether Pony can make async database queries or not depends on the database
driver. For example you can use the psycopg2 driver with the psycogreen
module for PostgreSQL and it will allow you to make asynchronous queries.
(see https://bitbucket.org/dvarrazzo/psycogreen/)
>From the Pony ORM point of view using gevent is nothing different from a
multi-threading application and Pony works fine with it. When working in a
multi-threading environment, Pony creates a separate database connection
for each thread. If your application is going to create a lot of
micro-threads, we'd recommend you to call disconnect() method of your Pony
Database object in each miсro-thread before the thread is done.
Also we'd recommend to limit the number of micro-threads which work with
the database simultaneously using the gevent.pool. Having too many
simultaneous connections to the database can hurt the database performance.
Regards,
Alexey
On Wed, Jul 9, 2014 at 6:48 AM, 王飞 <gf0842wf at gmail.com> wrote:
> Hi!
> Can we combine ponyorm with gevent to query asynchronously?
>
> _______________________________________________
> ponyorm-list mailing list
> ponyorm-list at ponyorm.com
> /ponyorm-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </ponyorm-list/attachments/20140710/1e8f8fe7/attachment.html>
More information about the ponyorm-list
mailing list