Posts tagged “replication”

  1. How do two replicas find what's different without sending everything?

    Comparing two replicas of a million 200-byte records: a full copy is 203 MiB, a hash per key 43 MiB. A Merkle tree found one changed key with 2 KiB of hashes and ten changed keys with 15 KiB. The catch is round trips: a deeper tree sends fewer bytes but needs more of them. Measured, with the code.

    · 6 min read · Data Structures

  2. CAP or PACELC: what trade-off do you make when nothing is broken?

    CAP describes the rare moment the network splits. PACELC adds the trade-off you make all day: a fresher answer costs latency. Measured on a PostgreSQL primary and replica: how often reading your own write is stale, what each synchronous_commit level costs, and what happens when the replica is gone.

    · 9 min read · Databases

  3. Read replicas, partitioning or sharding: what does each one fix?

    Three ways to outgrow one database, often confused. Replicas add read capacity and cost you freshness. Partitioning keeps one huge table manageable but adds no capacity. Sharding adds write capacity and costs you almost everything that was easy. Measured on PostgreSQL 17: replica staleness, and…

    · 8 min read · Databases