Skip to content

perf: add an opt-in read-only connection pool #401

Description

@chrispader

NitroSQLite now supports independent read-only connections to one database file, but callers must create, select, and close each connection themselves. A write-heavy app with long reads may benefit from an opt-in pool that routes independent read queries across a bounded set of handles while retaining one writer connection.

Design a small pool API on top of the existing independent-connection and native FIFO behavior. Bound the connection count, preserve each connection's configuration, reject writes on reader handles, and close all handles only after outstanding work has settled or been cancelled. Document the SQLite journal mode and snapshot semantics; a pool must not silently change a database's journal mode or promise parallel writes.

Before implementation, compare one connection with a small read pool on realistic mixed read/write workloads. Record queue wait, query time, peak memory, WAL size, and battery/CPU cost on iOS and Android. Avoid a default pool until measurements show a benefit beyond the existing independent-connection API.

Related: #62, #364, #369. The independent read-only connections are already available; this issue tracks automatic routing and lifecycle only.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:apiPublic JavaScript or TypeScript API and types.area:runtimeDatabase lifecycle, SQL execution, transactions, or native runtime.enhancementNew capability or improvement, proposed or implemented.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions