4 ms·
As much as I love gevent I can't claim in good conscience that it always "just works" for me. It tends to just work until it doesn't, and then you're stuck inve
by ekimekim 8y ago
As much as I love gevent I can't claim in good conscience that it always "just works" for me. It tends to just work until it doesn't, and then you're stuck investigating how a dependency of a dependency just switched to using a network library implemented in C that therefore isn't monkey-patchable and causes process-wide stalls.
I've gotten good at diagnosing these issues over many years as a heavy gevent user, and it doesn't stop me highly reccomending gevent to anyone who will listen, but it's a caveat that should be mentioned for anyone new starting out.
- jacob019 8y agoWhat libraries have you run into trouble with?
- ekimekim 8y agogrpc is one that we're struggling with at the moment, psycopg2 is another that won't Just Work (you need to use a special "adapter" that teaches the underlying C library to hook into the event loop). In general anything that is a) not implemented in pure python, and b) doing calls that you expect to be monkey patched (mainly network calls). This is thankfully fairly rare, but it is something you need to be aware of.
- jacob019 8y agoThere are pure python alternative implementations of these protocols and of mysql, anything pure python works well, but of course there are modest CPU costs. Then there are workarounds if you must use C libraries with blocking IO, like using a pool of sub-processes. But using C libraries for IO is pretty low level stuff, and making them concurrent is beyond the scope of python.
- meowface 8y agoIt definitely causes problems when dealing with native modules that have networking functionality, but I've almost never had a need to use those modules. Also, wouldn't asyncio probably have similar issues with native modules as well?