Hard coded sqlite connection size limits limits concurrency and varies with password presence #1604

Closed
opened 2026-02-06 10:17:07 +00:00 by thesimplekid · 0 comments
thesimplekid commented 2026-02-06 10:17:07 +00:00 (Migrated from github.com)

The current SQLite connection sets the max number of connections based on the presence of a password. I don't see why this is the case having a password should not determine the number of connections we have.

Since the database is configured with pragma journal_mode = WAL (Write-Ahead Logging), SQLite is capable of handling multiple concurrent readers. Limiting the pool to a single connection for unencrypted databases serializes all operations, negating the performance benefits of WAL mode, while encrypted databases arbitrarily receive a higher limit.

I think we should set this to some more reasonable number and in the mint we could even reuse the connection limit setting we have for psgl.

github.com/cashubtc/cdk@3e6474bbd9/crates/cdk-sqlite/src/common.rs (L24-L31)

The test restore seems to often fail with timeout issues in ci, I am wondering if having more readers would help this?

The current SQLite connection sets the max number of connections based on the presence of a password. I don't see why this is the case having a password should not determine the number of connections we have. Since the database is configured with pragma journal_mode = WAL (Write-Ahead Logging), SQLite is capable of handling multiple concurrent readers. Limiting the pool to a single connection for unencrypted databases serializes all operations, negating the performance benefits of WAL mode, while encrypted databases arbitrarily receive a higher limit. I think we should set this to some more reasonable number and in the mint we could even reuse the connection limit setting we have for psgl. https://github.com/cashubtc/cdk/blob/3e6474bbd9f2e8cd69ec7a8879de8f599007c081/crates/cdk-sqlite/src/common.rs#L24-L31 The test restore seems to often fail with timeout issues in ci, I am wondering if having more readers would help this?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cashubtc/cdk#1604
No description provided.