AlgoViz

Trade-offs in databases

medium 30 min

Every database trades freshness, speed, safety and uptime against each other.

Where it shows up

The same pattern appears across everyday software.

  • Dynamo, the 2007 paper

    Services chose N, R and W. Several used (3, 2, 2). It also used sloppy quorums, so overlap was not strict.

  • Cassandra across datacenters

    LOCAL_QUORUM needs a majority only in the coordinator's datacenter, so a request does not wait for the other side of the world.

  • DynamoDB tables

    Reads are eventually consistent unless the call asks otherwise. Strong reads are served by the leader of the partition and cost twice as much.

  • MongoDB replica sets

    Majority is the default write concern, so a confirmed write survives the loss of the primary. Applications may lower it for metrics.

  • PostgreSQL with a synchronous standby

    Commits wait for a second machine. With only one standby named, its failure makes commits wait, so two candidates are common.

  • Azure Cosmos DB

    Five levels on one menu, from strong to eventual. The level can be relaxed for a request.