Distributed, high-performance blob storage on SQLite
Zerodha built Blobasaur, a custom distributed blob store written in Rust that uses SQLite and speaks the Redis protocol to handle high-throughput user workspace storage.
read it Provides a detailed architectural deep-dive into overcoming SQLite's write limitations for high-throughput blob storage using sharding, compression, and the Redis protocol.
summary
Zerodha developed Blobasaur to replace SSDB for storing high-throughput, multi-megabyte JSON user preferences and workspace layouts. Built in Rust and backed by SQLite, it uses consistent hashing across multiple shards, group commits, and zstd compression to achieve single-digit millisecond latency at thousands of requests per second. The system implements the Redis protocol for drop-in compatibility, utilizing a cluster layout to scale across nodes while trading strict durability for high performance.
key points
- Blobasaur shards data across multiple SQLite files on a single node, using consistent hashing and per-shard group commits to bypass single-writer bottlenecks.
- Applying zstd compression reduced average 63 KB JSON payloads down to 5.5 KB, dramatically lowering page cache and WAL pressure.
- The system speaks the Redis protocol and uses a static 16384 hash slot cluster topology for multi-node distribution without modifying existing client applications.
who should read it
Backend and infrastructure engineers interested in custom storage engines, SQLite internals, and high-throughput system design.
discussion skeptical
consensus
Commenters are deeply skeptical about using SQLite as a high-throughput blob store, warning that it frequently leads to maintenance nightmares and arguing that traditional metadata-plus-object-store architectures are superior.
pushback
Critics also pointed out major gaps in Blobasaur's current production readiness, such as the lack of automatic failover, replication, and dynamic slot rebalancing.
I spent years trying to squeeze this use case out of sqlite. All roads lead to tears, it is not made for this use case.
I wrote https://github.com/anacrolix/possum for this exact use case. It has a few rough edges but it absolutely hauls ass for caching on disk. Incidentally it uses sqlite for transaction/TTL metadata which is more suited to sqlite but it's still the bottleneck.
sqlite transaction commit overhead is too high and uncompetitive without batching but it's a design flaw specific to being multiprocess.
Draws on personal experience to warn that SQLite transaction commit overhead makes it ill-suited for this kind of heavy key-value workload.
Generated by an LLM from the article and thread. Check the sources before relying on it.