Architecture Decision Record (ADR) Engineering Template
Standard ADR template (Michael Nygard format) documenting architectural decisions, status, context, consequences, and tradeoffs.
ADR 007: Adoption of SQLite WAL Mode for Single-Node Workloads
📊 Status
Accepted (Supersedes ADR 003) — 2026-10-09
👥 Deciders
- Architecture Team
- Core Infrastructure Lead
🔍 Context & Problem Statement
Our application requires sub-millisecond read latency for metadata lookups and paste resolutions. Running a standalone managed PostgreSQL cluster introduces network hops (~2-5ms latency per query) and recurring cloud infra costs. We need an embedded, zero-maintenance database engine that satisfies ACID guarantees with high concurrent read throughput.
💡 Decision Drivers
- Zero external network latency for read-heavy workloads (95% reads, 5% writes).
- Minimal operational complexity and memory footprint on modest VPS instances.
- Strict ACID transactions with atomic commits.
- Seamless automated file backups and replication.
⚖️ Considered Options
- Option 1: Standalone PostgreSQL 16 with PgBouncer connection pool.
- Option 2: Embedded SQLite with WAL mode and memory tuning pragmas.
- Option 3: Redis Stack as primary persistent data store.
✅ Decision Outcome
Chosen Option: Option 2 (Embedded SQLite with WAL mode).
Rationale:
SQLite running with PRAGMA journal_mode = WAL permits concurrent readers without locking writers. In-process memory execution brings single-row lookup times under 0.2ms. Litestream can be attached for continuous real-time S3 streaming backups.
📈 Consequences
Positive:
- Query latency dropped from 3.8ms (PG TCP) to 0.15ms (direct SQLite).
- Zero external database hosting fees.
- Instant dev environment setup with single file
database.sqlite.
Negative & Mitigations:
- Write Concurrency: Only one writer active at a time.
- Mitigation: Enable
PRAGMA busy_timeout = 5000and defer heavy batch jobs to background worker queues.
- Mitigation: Enable
Replies 0
No replies yet
Every reply is a note. Start a discussion, ask a question, or attach a code snippet.
Related Documentation & Markdown & Documentation & Markdown Blueprints
Production-ready configurations and diagnostics from the verified Supanote library.
Open-Source Contributing Guidelines (CONTRIBUTING.md) Template
Comprehensive guidelines for open-source contributors covering issue reporting, branch naming conventions, and local dev setup.
GitHub Security Policy (SECURITY.md) Vulnerability Template
Standard GitHub SECURITY.md template outlining supported versions, responsible disclosure SLA, and PGP key fingerprint.
llms.txt Standard Specification Template for AI Agents
Clean llms.txt standard layout for LLM crawlers and AI coding assistants like Claude, Cursor, and ChatGPT.
Modern Open-Source GitHub README.md Specification Template
Clean, comprehensive developer README template featuring status badges, live preview section, architecture overview, and quick-start.
Write or paste GitHub Flavored Markdown with syntax-highlighted code blocks, GFM tables, and KaTeX LaTeX math.