SQLite WAL mode on a tiny VPS

2026-08-14 · 4 min read

Most of my side projects use SQLite. It is fast, it is a single file, and backups are trivial. The one setting I now enable everywhere is write-ahead logging:

PRAGMA journal_mode = WAL;
PRAGMA synchronous = NORMAL;
PRAGMA busy_timeout = 5000;

What changes

Readers no longer block the writer and the writer no longer blocks readers. On a 1 vCPU box with a few dozen requests per second, p99 latency for read endpoints went from ~40 ms to ~6 ms, simply because reads stopped waiting for the occasional write.

What to watch

The -wal file can grow if there is always an open read transaction. A periodic PRAGMA wal_checkpoint(TRUNCATE); from a cron job keeps it in check. Also remember to copy all three files (or use .backup) when taking backups.