Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

RocksDB Blog 9 min read Deep dive hardMaster

Blob Direct Write With Partitioned Blob Files

RocksDB's Blob Direct Write writes values at or above min_blob_size straight to blob files during the write, so the WAL and memtable carry only a compact BlobIndex reference instead of the full value. A per-column-family BlobFilePartitionManager maintains multiple active blob partitions, and a pluggable BlobFilePartitionStrategy lets applications group values by policy. For example, routing similar-TTL values together concentrates garbage so whole blob files can be deleted while Universal Compaction handles keys and metadata. Blob files are registered in the MANIFEST only at memtable flush via a generation-based lifecycle, and v1 cannot recover unflushed direct-write state from the WAL after a crash. v1 also requires the ordered single-memtable-writer mode and excludes pipelined/concurrent writes, MemPurge and user-defined timestamps.

Assumes: LSM treesRocksDB BlobDBWAL and memtablescompaction strategies

Related posts

  • Litestream Revamped: SQLite Replication

    Fly.io mediumAdept

    Litestream is being reworked around ideas from LiteFS. It replaces the raw-WAL "shadow WAL" with transaction-aware LTX files, sorted page changesets that can be compacted LSM-style, so point-in-time restores no longer replay every intermediate page write. Conditional writes in S3 and Tigris provide a time-based lease that guarantees a single writer per destination without Consul, which removes the need for multiple "generations" and makes failover and replica resync simpler. Planned additions are a VFS-based read-replica layer that fetches and caches pages straight from object storage, and wildcard replication of hundreds or thousands of databases from one process.

  • How does Turso Cloud keep your data durable and safe?

    Turso mediumAdept

    Turso Cloud makes every SQLite database durable on S3 and S3 Express, treating local server disk purely as a cache. Database files are split into 128kB segments grouped into generations, while recent WAL writes are acknowledged only after landing in low-latency S3 Express, with frequent checkpoints (around every 1MB). Segmenting enables lazy fetching, bounded per-tenant local storage and safe replacement of compute nodes. Continuous backups with 90-day point-in-time restore and instant metadata-only branching fall out of the same design.

  • Postgres Bloat Minimization

    Supabase mediumAdept

    Postgres stores table rows in 8KB heap pages and writes a new row version on every update, so dead versions accumulate until vacuum reclaims them and updates the free-space and visibility maps. Bloat usually means autovacuum never started, because the default 20% scale factor is too high for large tables, or it started but couldn't finish because of long-running idle transactions or SHARE UPDATE EXCLUSIVE locks. The fixes include lowering per-table scale factors, setting idle_in_transaction_session_timeout, cancelling stuck backends, and raising autovacuum_max_workers or autovacuum_work_mem. VACUUM FULL or pg_repack returns space to the filesystem after mass deletes; VACUUM FULL takes an exclusive lock and pg_repack does not.

  • An adventure in writing compatible systems

    Turso mediumAdept

    Turso, a Rust rewrite of SQLite, hit a bug where every write after the database crossed 1GB made SQLite's integrity checks fail, even though Turso's own checks found the file intact. The cause was the SQLite "pending byte" page: once a file passes the 1GB mark, SQLite reserves a special page tied to file locking, and Turso did not reserve it. The deterministic simulation tests had missed the bug because every profile injected faults, so no test database ever grew to 1GB. Adding fault-free runs fixed that gap, a reminder that compatible rewrites must match undocumented-feeling quirks of the original implementation.

  • Making multiplayer more reliable

    Figma mediumAdept

    Figma added a write-ahead journal to its in-memory multiplayer service, which previously persisted files only via full checkpoints to S3 every 30–60 seconds. Incremental changes are now batched and written to DynamoDB with sequence-number ranges. File ownership is enforced with a lock table and conditional writes to prevent split-brain corruption. Cross-region durability comes from guaranteeing a checkpoint within 30 minutes, since DynamoDB global tables would have cost about 6x more. After ~400K byte-identical replay validations during a dark launch, the journal handles over 2.2B changes per day, persists 95% within ~600ms, and removes checkpoint write spikes during deploys.

The quest for software engineering knowledge.

Look:
Layout: