Vector Clock
ELI5 — The Vibe Check
A vector clock is a way for distributed servers to figure out the order of events without a synchronized wall clock. Each server keeps a counter, and they share counters with every message. By comparing counters, they can tell if event A happened before event B, or if they happened concurrently. It's like distributed time-keeping without actual clocks.
Real Talk
A vector clock is a logical clock mechanism for tracking causality in distributed systems. Each node maintains a vector of counters (one per node), incrementing its own counter on each event and merging vectors on message receipt. Comparing vectors reveals happened-before relationships or concurrency. They're used in systems like DynamoDB and Riak for conflict detection.
When You'll Hear This
"Vector clocks tell us if two updates are causally related or truly concurrent." / "DynamoDB uses vector clocks to detect conflicting writes across replicas."
Related Terms
Conflict Resolution
Conflict resolution is what happens when two database servers both change the same thing at the same time and then try to sync up.
Distributed Database
A distributed database spreads your data across multiple computers that work together like a hive mind. If one server dies, the others pick up the slack.
Eventual Consistency
Eventual consistency means 'give it a moment and everything will match up.' You write data to one server, and the other servers will get the update...
Multi-Primary Replication
Multi-primary replication lets multiple database servers accept writes simultaneously, like having multiple cashiers at a store.