A trading platform generating thousands of storage requests per second sounds like an obvious candidate for a large database cluster. Blobasaur takes a less conventional route. This open-source server implements distributed blob storage on SQLite by combining a Rust storage engine, multiple sharded databases and carefully chosen durability settings. The result is a focused system for reading and repeatedly overwriting JSON documents and other modestly sized blobs—not an attempt to turn SQLite into a universal distributed database.
Blobasaur grew out of a real workload at Kite, the trading platform operated by Zerodha. Its story illustrates an important engineering principle: storage architecture should follow access patterns rather than industry fashion. SQLite can deliver remarkable performance when a system works with its constraints, especially its single-writer model, instead of pretending those constraints do not exist.
Why Kite needed a different blob store
Kite needed to persist large numbers of opaque application blobs, including frequently updated JSON data. The application generally knew a key and wanted to fetch, replace or expire its associated value. It did not need joins, secondary indexes or queries into the contents of every document.
According to the published account of Blobasaur’s design, the developers had previously used CouchDB and SSDB. CouchDB offered document-oriented features, but its operational and storage characteristics were not a comfortable match for a high-volume overwrite workload. SSDB provided a Redis-like interface over an embedded key-value engine, yet it also presented reliability and maintenance concerns for this use case.
The team considered several familiar alternatives:
- PostgreSQL is dependable and flexible, but repeatedly updating many blobs can create dead tuples, write amplification and vacuum work. Its relational capabilities were mostly unnecessary here.
- ScyllaDB can scale to demanding distributed workloads, but brings substantially more operational machinery than a simple key-to-blob service may justify.
- Amazon S3 is exceptionally durable object storage, although network latency, API semantics and per-operation economics differ from those of a low-latency mutable key-value store.
- MinIO and SeaweedFS are capable object or file storage systems. Kite’s workload, however, centered on small blobs that were overwritten frequently rather than large, mostly immutable objects.
Blobasaur was therefore built around the narrower workload: point reads, complete-value writes, expiration and deletion at high request rates.
Blobasaur’s blob storage architecture
A single SQLite database permits many readers but only one active writer. Blobasaur does not remove that rule. It creates multiple SQLite databases, or shards, so writes to different shards can proceed independently. A key is mapped deterministically to a shard, allowing the server to find a blob without maintaining a separate lookup index.
Application using a Redis client
|
v
Blobasaur protocol server
|
key hashing / routing
+------+------+------+
| | |
v v v
Shard 0 Shard 1 Shard N
SQLite SQLite SQLite
WAL + TTL WAL WAL
| | |
+------ asynchronous write queues
|
optional multi-node partitioningEach shard stores keys, blob values and expiration metadata. Reads can take advantage of SQLite’s efficient indexed lookups, page cache and memory mapping provided by the operating system. Writes are sent through controlled paths rather than allowing an unrestricted number of request handlers to compete for SQLite’s writer lock.
Additional Blobasaur nodes can partition the keyspace, extending the same sharding idea beyond one machine. Partitioning spreads capacity and traffic, but it should not be confused with automatic replication or consensus. Operators must verify the replication, failover and backup guarantees of the exact version they deploy. Distribution alone does not make a system highly available.
Why Rust and the Redis protocol matter
Blobasaur is written in Rust, which is a practical fit for a networked storage service that needs concurrency, predictable resource use and memory safety. The Rust storage engine coordinates connections, routing, queues and lifecycle jobs while SQLite remains responsible for durable local data structures and transactional file updates.
The server speaks the Redis protocol for its supported operations. Applications can therefore use common Redis client libraries rather than adopting a custom wire format. Compatibility should be understood at the protocol and command-subset level: Blobasaur is not a drop-in implementation of every Redis data type, command or clustering behavior. Its API is intentionally centered on blob operations such as setting, retrieving, deleting and expiring values.
How SQLite performance is extracted safely
WAL mode separates readers from the writer
SQLite’s write-ahead logging mode records changes in a WAL file before they are merged back into the main database. Readers can continue using a stable snapshot while a write is in progress, which reduces read/write interference. WAL still allows only one writer per database, so its benefit comes from smoother concurrency—not parallel writers inside one shard. The official SQLite WAL documentation also explains checkpoint behavior and the requirement that participating processes share a host filesystem.
Asynchronous writes change the durability boundary
Blobasaur can process writes asynchronously and organize them through shard-specific queues. This avoids turning every incoming request into an independent, fully synchronized disk operation. It also enables the service to preserve read-your-writes behavior: a client reading immediately after a successful update should receive the newest accepted value rather than an older database snapshot.
That speed has a price. If success is acknowledged before data reaches durable storage, a crash can lose a small window of accepted writes. SQLite’s synchronous setting, queue behavior, batching policy and storage hardware all affect that window. Teams must define whether “written” means accepted into memory, appended to a WAL or forced to stable media. There is no configuration that simultaneously maximizes throughput, minimizes latency and guarantees zero loss after sudden power failure.
Compression, TTL cleanup and incremental vacuuming
Optional compression can reduce disk consumption and I/O for compressible JSON blobs, at the cost of CPU time and an inability to inspect values directly with ordinary SQL tools. Whether it helps depends on payload size, compressibility and the machine’s CPU-to-storage balance.
TTL support gives records an expiry time, while background cleanup removes expired entries without burdening every read. Deleting rows does not necessarily shrink a SQLite file immediately. Incremental vacuuming lets the service reclaim free pages progressively, avoiding the disruptive cost of rebuilding a large database in one operation. Cleanup rate, checkpoint frequency and vacuum work must be bounded so maintenance does not become the dominant writer.
SQLite vs PostgreSQL and object storage
| Option | Best fit | Trade-off for Kite’s workload |
|---|---|---|
| Blobasaur with sharded SQLite | Low-latency key-based reads and complete blob overwrites | Purpose-built API; durability and availability require deliberate configuration |
| PostgreSQL | Relational queries, constraints, transactions and rich indexing | More database machinery and maintenance for opaque, frequently replaced values |
| ScyllaDB | Large distributed datasets requiring horizontal scale | Greater deployment and operational complexity |
| S3 or compatible object storage | Highly durable, large or mostly immutable objects | Different latency, overwrite and request-cost profile |
| MinIO or SeaweedFS | Self-hosted object and file storage | Architecture is oriented toward object or file workloads rather than a narrow mutable-blob API |
| Redis | Extremely fast in-memory data access | Memory cost and persistence semantics may not suit a large durable blob collection |
The SQLite vs PostgreSQL decision is not about which database is universally faster. PostgreSQL is the stronger choice when an application needs ad hoc queries, multi-row relational transactions, replicas and mature database administration. SQLite becomes attractive when access is almost entirely by primary key and the application can partition write contention.
Likewise, SQLite vs object storage is not a simple benchmark contest. S3-style systems excel at durable object retention and enormous capacity. Blobasaur targets faster mutation of comparatively small values through a key-value interface. A platform may reasonably use both: Blobasaur for hot mutable state and object storage for large assets, archives or backups.
Practical lessons and limits
Blobasaur demonstrates several reusable design lessons:
- Shard around the real bottleneck. Because SQLite has one writer per database, multiple database files create multiple independent write lanes.
- Keep the data model narrow. Opaque blobs, primary-key access and whole-value replacement avoid distributed query planning and secondary-index coordination.
- Expose familiar interfaces carefully. Redis protocol support simplifies integration, but applications should depend only on commands and semantics Blobasaur explicitly implements.
- Measure maintenance. WAL checkpoints, TTL deletion, compression and incremental vacuuming consume real CPU, I/O and writer time.
- State durability honestly. Asynchronous acknowledgement is a product decision, not merely a performance tweak.
This architecture is most suitable when keys can be partitioned, values are retrieved as a whole, writes do not require cross-key transactions and the organization can tolerate its chosen durability window. Hot keys, very large objects, analytical queries, strict multi-region consistency or extensive relational operations point toward other systems.
Most importantly, thousands of requests per second do not prove that SQLite can replace every sharded database or object-storage service. They show that a constrained workload, a lean protocol and disciplined sharding can turn an embedded database into an effective component of a high performance storage service.
Frequently asked questions
Is Blobasaur a distributed database?
It is a distributed blob storage server that can partition keys across nodes and SQLite shards. That does not automatically imply the replication, consensus, cross-shard transactions or failover guarantees associated with general-purpose distributed databases. Evaluate those properties separately.
How does Blobasaur work around SQLite’s single-writer limitation?
It divides data among multiple SQLite database files and routes each key to a shard. Every shard still has one active writer, but separate shards can accept writes independently. WAL mode helps readers continue while a shard is being written.
Can Blobasaur replace Redis?
Not as a general Redis replacement. Redis protocol compatibility lets existing clients communicate with Blobasaur’s supported blob commands. It does not provide Redis’s complete collection types, scripting, pub/sub or every clustering semantic.
When should a team avoid SQLite blob storage?
Avoid this pattern when the application needs relational queries, transactions spanning many keys, automatic multi-region replication, extremely large streaming objects or durability guarantees the chosen asynchronous configuration cannot provide. PostgreSQL, ScyllaDB or an object-storage platform may be a better fit in those cases.