Per-Key Sequential Consistency
What You'll Learn
You'll learn how systems can provide strong ordering guarantees for individual data items without the cost of coordinating across the entire database.
The Core Idea
Per-key sequential consistency means that all operations on a single key appear to execute in some sequential order that all clients agree on, but operations on different keys can be reordered independently. Unlike global sequential consistency (which orders all operations across all keys), this model only guarantees consistency within each key's operation history.
Think of it like individual checkout lines at a grocery store: customers in line #3 see everyone ahead of them in that specific line, but they have no idea what order people in line #7 are being served. Each line maintains its own clear order.
Why This Matters
Global sequential consistency is expensive—coordinating every operation across all data requires massive synchronization overhead. Per-key sequential consistency gives you strong guarantees where you need them (individual data items) while allowing the system to process unrelated keys in parallel without coordination.
For example, if you're updating a user's profile and someone else is updating their own profile, those operations can happen concurrently without waiting for each other. But if two operations try to update the same user's balance, they'll execute in a clear, agreed-upon order.
Trade-offs
This model is weaker than linearizability (which orders all operations globally) but stronger than eventual consistency. You lose cross-key ordering guarantees—if you update key A then key B, another client might see the new B before the new A.
Key Takeaway: Per-key sequential consistency provides strong ordering guarantees at the granularity of individual keys, enabling efficient parallelism for unrelated data while maintaining predictable behavior within each key's operations.