Sarat Chandra describes how Zerodha replaced an unmaintained blob store with Blobasaur, a Rust server backed by SQLite. Its workload is chart layouts and workspace preferences, with frequent overwrites and roughly equal reads and writes. Those requirements shape the design:
- Compress before storing. Production JSON averaged 63.6 KiB before compression and 5.5 KiB afterward. Most compressed values fit the small-blob workload SQLite handles well.
- Shard the writers. Each database file has one writer, a bounded queue and batched transactions. Multiple files let writes proceed in parallel while read-only connections serve readers.
- Keep maintenance in the same queue. A separate expiry worker caused write-latency spikes by competing for SQLite’s write lock. Small cleanup batches through the existing writer removed that contention.
- Make acknowledgments mean something explicit. Normal mode can lose recent commits after power loss. Optional early acknowledgments require a pending-write map, including deletion markers, that every read path checks.
- Preserve the client protocol. Redis compatibility supported a phased migration, with dual writes, historical backfill and fallback reads before retiring SSDB.
Zerodha reports production p99 latency around 2 ms across three modest nodes. Its separate sharding benchmark used memory-backed storage, so those throughput figures isolate CPU and locking costs rather than durable-disk performance. Cluster slot assignment is static, with automatic failover and live rebalancing still absent.
A small storage engine can support a substantial service when the surrounding system matches the workload. Compression, expiry scheduling and the exact point at which a write is acknowledged matter as much as the database choice.