NEW RasterizedDB 1.1.0 is out: sharding and the gateway, the message broker, roles and row-level security, compression, .NET on NuGet, and the enterprise edition. What's new ›
REPLICATION

Every node takes writes.

Multi-primary replication: a transaction committed on one node is batched, compressed and shipped to the others over TLS 1.3, ordered by a hybrid logical clock. No primary to fail over from, no promotion step when one goes away.

HOW IT WORKS · ANIMATED 12 s cycle

A commit on one node, applied on every other

Multi-primary replication: every node takes writes. A committed transaction is captured through the write-ahead log, batched, compressed and shipped over TLS 1.3, and applied on each peer exactly once.

NODE 1 · PRIMARY COMMIT tx 57 hlc 17:40:00.123 · 4 REPLICATION LOG · VIA WAL tx 57 · users 8812 · city written before the commit returns BATCH PER PEER read from where the peer is linger, then zstd if it helps 12-byte frames, bounds-checked links: TLS 1.3 · pinned certs or a cluster CA NODE 2 · PRIMARY takes its own writes too ✓ applied tx 57, once one sync per batch, HLC order NODE 3 · PRIMARY ✓ applied tx 57, once tx 61 here changed the same row policy: abort · skip · last-writer-wins default: abort eventually consistent: nodes converge, they do not vote
  1. 1
    Commit on node 1

    A transaction commits on node 1 and is stamped with a hybrid logical clock: milliseconds plus a counter.

  2. 2
    Captured ahead

    Its changes are written to the replication log through the same write-ahead log, before the commit returns.

  3. 3
    Batched and compressed

    Each peer link reads from where that peer is, gathers a batch over a short linger, and compresses it with zstd when that helps.

  4. 4
    Shipped over TLS 1.3

    Peers pin each other's certificates or trust a cluster CA.

  5. 5
    Applied exactly once

    Each peer applies one batch per sync, each transaction once, in HLC order. Loops in a mesh are cut.

  6. 6
    Conflicts by policy

    If node 3 changed the same row at the same time, the policy decides: abort (default), skip, or last writer wins.

1 / 3

The shape

Every node accepts reads and writes. Commits are captured ahead of the commit through the database's own write-ahead log, read from where each peer is, batched with a linger, compressed with zstd when that helps, and applied on the far side one batch per sync, each transaction exactly once.

  • Its own rastcp listener and port, TLS 1.3
  • Mutual certificate pinning or a cluster CA
  • Loop prevention in a mesh of any size
  • Reconnect and resume from the peer's applied position
2 / 3

Conflicts, decided by you

Two nodes can change the same row at once. You choose what happens: abort the second (the default), skip it, or let the last writer by hybrid-logical-clock time win. A commit can also wait for a quorum of peers (REPLICATION SET mode = 'quorum:1').

SQL
REPLICATION ADD PEER 'berlin' ADDRESS '10.0.0.2:61171';
REPLICATION ADD PEER 'tokyo'  ADDRESS '10.0.1.7:61171' WITH (COMPRESSION = 'zstd:3');
REPLICATION SET conflict = 'last-writer-wins';
REPLICATION ENABLE;
SHOW REPLICATION PEERS;
3 / 3

What it is, and what it is not

This is eventually consistent multi-primary replication, not consensus. Nodes converge; they do not vote. It is the right shape for two sites that must both stay writable through a link failure, and for read scaling close to users. A commit acknowledged on one node is durable there before it is shipped.

HLC48-bit ms + 16-bit counter, monotonic under clock skew
zstdnegotiated per link
170tests, incl. power-cut images of both sides
✓ page rendered in 186 µs axum + tera + htmx · no other javascript