12 ms·
It's worth noting that DB drivers that actually integrate with libuv are a minority - most DB divers use Node-level network APIs and are unaffected by such thre
by laggyluke 11y ago
It's worth noting that DB drivers that actually integrate with libuv are a minority - most DB divers use Node-level network APIs and are unaffected by such thread pool limits.
- masklinn 11y agoEven when the db drivers integrate with libuv, there is little reason to use blocking APIs for that. The threadpool is primarily used for operations for which no non-blocking API is available (mostly filesystem access).
- eknkc 11y agoWhy would a DB driver need to integrate with libuv in the first place?
- coldtea 11y agoTo be evented and get the respective performance gains in a Node setting?
- paraboul 11y agoIn the case where the driver (for instance the official libmysql) doesn't expose its network interface (e.g. its sockets can't be used with an external event loop). In that case, it would block on IO operation, and there is no other choice but to push it to another thread. That said, using a driver in another thread leads to various complexities that can be avoided when running in the same application (javascript/v8) thread/event loop.