Open
Description
node-sqlite3
runs queries for the distinct prepared statements in independent worker pool tasks but all sqlite3 queries to the same sqlite3 connection internally serialized on the mutex. So other libuv worker pool tasks (dns resolution, crypto, etc) could be delayed while the pool spends a large amount of time waiting on sqlite3 mutex.
Wall clock profiling flamegraph (thread pool spends ~34% of wall clock time waiting on sqlite3 mutex):
Probably all queries (including prepared statement queries) to the same Database
should be scheduled in the single queue.