-
Notifications
You must be signed in to change notification settings - Fork 0
SqliteProductionTuning
title: SQLite Production Tuning (WAL, Concurrency, VFS) radar_quadrant: Techniques radar_ring: Assess radar_position: outer
SQLite carries a reputation as a "toy" database unfit for real application traffic, largely because its default settings serialize writers and can stall under concurrent load. This technique is a specific configuration set that addresses that directly, rather than a case for or against SQLite in the abstract.
The Micrologics writeup recommends enabling Write-Ahead Logging with PRAGMA journal_mode = WAL paired with PRAGMA synchronous = NORMAL, which reduces disk sync overhead while WAL mode still protects against corruption. For high-write workloads, it suggests manually triggering passive checkpoints (PRAGMA wal_checkpoint(PASSIVE)) in a background thread to stop the WAL file from growing unbounded while readers are active. On concurrency, it recommends PRAGMA busy_timeout = 5000 so lock contention retries automatically instead of failing immediately, wrapping any write-containing transaction in BEGIN IMMEDIATE to avoid deadlocks, sizing PRAGMA cache_size to around 64MB so the working set stays in memory, and enabling PRAGMA mmap_size at roughly 1GB to memory-map file reads.
For scaling beyond a single machine, the article points to two VFS-layer (virtual file system) replication tools: Litestream, which streams WAL frames continuously to object storage such as S3 with near-zero overhead, and LiteFS, a FUSE-based virtual file system that distributes SQLite across a cluster with read replicas.
The source gives no measured latency or throughput numbers. Its performance claims — that a properly tuned instance can handle "hundreds of concurrent requests and millions of queries per day" with "sub-millisecond" local query execution — are stated qualitatively, without benchmark data attached.
Placed in Techniques / Assess / outer.
The PRAGMA and VFS configuration set is specific and directly actionable, which makes it a real technique rather than a vague recommendation. The performance claims backing it, however, are unverified qualitative assertions rather than measured results, which caps confidence in the technique's real-world impact until tested. No first-person production use exists yet, so this sits at Assess. Outer reflects the added uncertainty from unbenchmarked claims.
Trial gate: apply this configuration set to a real SQLite-backed service in the user's own production workflow and observe the actual concurrency and latency behavior.