vado / docs
GitHub

How it works

Read replicas

Each shard can keep a memory-only copy in other regions, fed from its AOF. Routers read the nearest one, a connection always reads its own writes, and an idle database's replicas sleep.

Regions

With a replicas list, every data shard keeps one replica in each listed region. Writes always go to the primary. Like the shard count, the list is fixed when the database is created.

Bench API
curl -H "authorization: Bearer $TOKEN" "$BASE/db?db=mydb&shards=4&replicas=world"

A router maps where it runs to one of the nine regions and reads from the replica there, including the primary's own region. With none there, it tries a neighbour; with no match, the primary.

Router inThen tries
wnam, enameach other
weur, eeureach other
apac, oceach other
samenam, wnam
meeeur, weur
afrweur, eeur

Copy, then stream

FLUSHALL
Base and incremental files, 1 MB at a time
Appends since
PING marker
Serving

The primary sends its AOF files as commands, then every append after them, over one socket per replica. The stream leaves through the primary's output gate like its replies, so a replica only receives committed writes. Its +PONG to the marker means it has run everything before it, and only then does it serve reads.

Replicas run with import-mode and no memory limit, so they never expire or evict keys on their own. Reads still hide expired keys, and the primary's stream deletes them.

What a replica read can see

A read goes to a replica only if all of these hold, and to the primary otherwise:

  • It is read-only, doesn't block, and its keys are in one slot.
  • The connection is not in MULTI and has no active WATCH.
  • The connection has no write in flight to that shard, and none answered in the last 2 s.
  • No router in the same process saw that replica fail in the last 5 s.

So a connection reads its own writes while replicas are under 2 s behind. A read on another connection can be one replication lag old: p50 3 to 41 ms, p99 38 to 141 ms across nine regions at light load.

WAIT numreplicas timeout returns how many replicas have every write the connection made, counting the shard it wrote to with the fewest. It adds visibility, not durability. WAITAOF answers 1 0, since every reply already waited for its shard's commit.

Failures

  • A replica resets. It starts empty and refuses reads. The primary copies it again 5 s later, and reads go to the primary meanwhile.
  • A replica falls behind. Unsent replication bytes count toward the primary's 16 MB input budget, so lagging replicas slow writes down. One more than 8 MB behind, or silent for 60 s, is dropped and copied again.
  • The primary resets. Its replicas keep serving what they have, which may miss its last writes, until it copies them again, about 10 s later.
  • The primary stops streaming to a replica it drops: it tells the replica to reset, so a replica never serves data that has stopped updating.

Idle sleep

After 10 minutes with no writes, no client activity on the primary and no replica reads, the primary retires its replicas, closes the streams and stops its alarm, so every object can be evicted. The next activity wakes it and it copies every replica again. A read meanwhile finds its replica retired and goes to the primary, which wakes it too.

Browse topics or type to search

Introductionvado runs real Valkey 9.1, compiled to WebAssembly, in Cloudflare Durable Objects. A router in a Worker spreads keys over the shards, so valkey-cli and ioredis see one ordinary server.What you getIntroductionA first commandIntroductionThe dashboardIntroductionRead onIntroductionQuick startCreate the Access application, deploy the Worker, and connect valkey-cli or ioredis. About ten minutes on Workers Paid.1. Create the Access applicationQuick start2. DeployQuick start3. Connect valkey-cliQuick start4. Connect from a WorkerQuick startRun it locallyQuick startArchitectureA router per connection, shard objects running Valkey with their AOF in SQLite, and memory-only replicas in other regions. What each part owns, and what it costs.Where everything livesArchitectureHow clients reach itArchitectureRouterArchitectureShardsArchitectureRead replicasArchitectureRewritersArchitectureCatalogArchitectureWatcher, Pulse and the dashboardArchitectureWhat the design buys, and costsArchitectureSharding and routingKeys hash to 16,384 slots, slots map to shards in contiguous ranges, and a database's size and placement are fixed when it is created.Slots and shardsSharding and routingShard countSharding and routingPlacementSharding and routingHow the router routesSharding and routingCROSSSLOTSharding and routingShard classesSharding and routingConnectionsSharding and routingUnsupported commandsSharding and routingDurabilityEvery acknowledged write is in SQLite before its reply leaves. Group commit keeps that cheap under load, a helper object compacts the AOF, and deploys restart shards without failing commands.Write-through storageDurabilityGroup commitDurabilityAOF rewrites in a helperDurabilityWhen a shard resetsDurabilityClean restarts on deployDurabilityRead replicasEach shard can keep a memory-only copy in other regions, fed from its AOF. Routers read the nearest one, a connection always reads its own writes, and an idle database's replicas sleep.RegionsRead replicasCopy, then streamRead replicasWhat a replica read can seeRead replicasFailuresRead replicasIdle sleepRead replicasLife of a requestWhat happens between a client sending SET k v and reading +OK, and what each reply tells you.One SET, step by stepLife of a requestWhat a reply tells youLife of a requestOperationsDeploy, configure, create databases with a placement, sign in to the dashboard, drive the bench API, and upgrade without breaking running shards.DeployOperationsSettingsOperationsCreate a database with a placementOperationsDashboard sign-inOperationsThe bench APIOperationsUpgrading safelyOperationsSecurityWho can connect, what clients may change, how data travels, where copies live, and what the bench token and the dashboard allow.AuthenticationSecurityWithout a passwordSecurityWhat clients can changeSecurityTransportSecurityReplicas and data locationSecurityThe bench token and the dashboardSecurityLimits and measurementsWhat one shard holds, how fast writes and reads went, and the conditions behind each number. Measured on production in November 2026, on one account.LimitsLimits and measurementsMemoryLimits and measurementsThroughputLimits and measurementsLatencyLimits and measurementsReplicasLimits and measurementsRewritesLimits and measurementsCold starts and deploysLimits and measurementsFailure testsLimits and measurementsWhat these don't showLimits and measurementsRedisA database can run Redis 8.12 instead of Valkey. It is opt-in at build time because it doubles the upload and is distributed under the AGPLv3.Choosing RedisRedisBuilding with RedisRedisDifferencesRedisThe AGPL licenceRedisRepositoryAn npm workspace: two apps and three packages. How to check, test and build it, and what CI runs on every push.LayoutRepositoryCommandsRepositoryEnd-to-end testsRepositoryContinuous integrationRepositoryThe wasm buildsRepositoryCode rulesRepository
Local search. Nothing is sent to a server.Esc to close
Documentation