Deno KV internals: building a database for the modern web
Deno KV's production backend runs on FoundationDB, with a custom "transaction layer" in front of it that handles multi-tenant configuration, JavaScript-native types such as bigint sums, and cross-region replication. To keep latency low, every atomic operation is non-interactive: a single bag of versionstamp checks, set/delete writes and conflict-free mutations that completes in one or two network trips. A sequencer assigns monotonic transaction sequence numbers, and an evaluator turns each batch into a dataflow graph of AND/MUX operations and evaluates it concurrently. Results are reused speculatively before a writer commits them to FoundationDB, which raises throughput without locks.
Related posts
- Announcing Deno KV
Deno mediumAdeptDeno KV is a strongly consistent key-value database built into the Deno runtime. It is backed by SQLite when run locally and by FoundationDB when managed on Deno Deploy, where it is globally replicated across 35 regions. The API stores structured-serializable JavaScript values under array keys, supports prefix listing with cursor pagination, and offers atomic multi-key transactions using check-and-set. Reads are strongly consistent (serializable and linearizable) by default and can opt into eventual consistency for lower latency, for example 7ms versus 94ms in Frankfurt during the beta.
- Announcing Deno Queues
Deno mediumAdeptDeno Queues adds two APIs to Deno KV, `enqueue()` and `listenQueue()`, for offloading or delaying background work with no infrastructure to configure. They are backed by SQLite locally and FoundationDB on Deno Deploy, where V8 isolates spin up on demand to process messages. Delivery is at-least-once, failed handlers retry up to 5 times before the message is dropped, and enqueues can join KV atomic transactions so messages are only sent if the transaction commits. Nonce checks inside those transactions give idempotent processing, and billing is per KV write plus one Deploy request per received message.
- Deno KV vs. Cloudflare Workers KV, Upstash Redis, AWS DynamoDB, and Google Firestore
Deno mediumAdeptA vendor-run benchmark compares Deno KV with Upstash Redis, DynamoDB Global Tables, Google Firestore and Cloudflare Workers KV by timing 10-record reads and writes from colocated serverless functions, with warm-up reads excluded. At p99, Upstash (139ms read) and Deno KV (90ms read, 166ms write) were fastest, while Cloudflare KV was slowest because its caching and eventual consistency make writes take up to 60s to become visible. The comparison also covers each store's consistency and isolation levels, per-million read/write pricing and setup experience. The databases offer different consistency guarantees, so the latency numbers are not strictly like-for-like.
- Use Deno KV in Node with the new official npm package
Deno mediumAdeptDeno KV is now usable from Node.js through the official @deno/kv npm package, which exposes the same API as Deno's built-in KV through a single openKv function. That function can connect to a managed Deno Deploy database backed by FoundationDB, a self-hosted denokv server, a local SQLite file, or an in-memory store for tests. Most methods are supported, including atomic, enqueue and watch, but listenQueue does not work against remote databases yet. The package targets Node 18+, has no third-party dependencies, ships platform-specific SQLite binaries built with NAPI-RS from the Rust denokv codebase, and stores values in V8's serialization format.
- How we built a general purpose key value store for Facebook with ZippyDB
Meta Engineering hardMasterZippyDB is Facebook's largest strongly consistent, geo-distributed key-value store, built by layering a reusable replication library (Data Shuttle) on RocksDB, Shard Manager and a ZooKeeper-based config service. Shards of 50–100 GB hold tens of thousands of μshards, enabling transparent resharding. Each shard keeps a small Multi-Paxos quorum plus async follower replicas, with epoch-based leader leases assigned externally. Consistency is chosen per request: fast-ack or quorum writes, and eventual (actually bounded-staleness), read-your-writes or lease-based strong reads. Serializable transactions use optimistic concurrency control on the primary within an epoch, and conditional writes reuse that machinery server-side.