4 ms·
Thanks! Your concern is valid though, if the database module is a wrapper around C library which uses blocking sockets, each database call will block the whole
by denik 17y ago
Thanks!
Your concern is valid though, if the database module is a wrapper around C library which uses blocking sockets, each database call will block the whole interpreter, not just a particular greenlet.
This is not specific to gevent thought. Tornado and Twisted face the same problem and Twisted has a threadpool to cope with that. I guess I would have to implement something similar for gevent.
However, if the database module was a pure Python or used libevent underneath then it would integrate with gevent seamlessly. Alas, it's rarely the case for database modules (?)
- simonw 17y agoMySQL Connector/Python is a pure-Python implementation of the MySQL client protocol - I presume it uses sockets, in which case the gevent monkey-patching might get it to work transparently. https://launchpad.net/myconnpy https://launchpad.net/myconnpy