Data Modeling hard
You are modeling a 'Likes' counter for a global social network. You choose an AP model. What anomaly must your data model handle?
- A Complete Write Unavailability, where the system enters a strict read-only mode whenever it detects a network partition between regional data centers.
- B Substantial Read Latency, as the database must perform a 'Quorum Read' across every single replica in the cluster to ensure that every counter is perfectly accurate.
- C Cascading Deadlocks, which occur when multi-region synchronization locks are held for extended periods, preventing any other transactions from being processed.
- D Divergent Counters, where different regions observe conflicting totals; you must utilize CRDTs (Conflict-free Replicated Data Types) to merge results eventually.
Answer: D. Divergent Counters, where different regions observe conflicting totals; you must utilize CRDTs (Conflict-free Replicated Data Types) to merge results eventually.
In an AP (Available and Partition-tolerant) system, you prioritize the ability to accept 'Likes' even when nodes cannot talk to each other. This results in 'Divergence'. To fix this, your data model cannot use simple integers; it must use specialized types like G-Counters or PN-Counters (CRDTs) that allow the system to mathematically merge the independent results of both regions into a single, correct total once connectivity is restored.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- When modeling a Distributed Transaction using the Saga Pattern (Choreography or Orchestration), what type of consistency do you achieve?
- Which practice prevents SQL Injection attacks?
- What is 'Bi-Temporal' data modeling (e.g., in SQL:2011 standard)?
- Adding an Index to a database column generally improves Read performance. What is the negative trade-off?
- Log Systems Merge (LSM) Trees (used in RocksDB, Cassandra) optimize for fast writes. What is their primary downside regarding Disk I/O?
- What is the primary objective of normalizing a relational database schema (e.g., to 3NF)?