Skip to content

Parallel queries blocks nodejs/libuv worker pool #1395

Open
@alex3d

Description

@alex3d

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):
image

Probably all queries (including prepared statement queries) to the same Database should be scheduled in the single queue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions