Data Modeling hard
When modeling a Distributed Transaction using the Saga Pattern (Choreography or Orchestration), what type of consistency do you achieve?
- A Strict ACID Consistency, where the system utilizes a global mutex lock to ensure that all distributed participants are perfectly synchronized at all times.
- B Linearizability, guaranteeing that every read operation returns the result of the most recent write across all interconnected microservices in real-time.
- C Eventual Consistency (BASE), which utilizes 'Compensating Transactions' (undos) to resolve failures and eventually return the system to a valid state.
- D Read-Your-Writes Consistency, ensuring that an individual user always sees the immediate results of their own actions, regardless of the global state.
Answer: C. Eventual Consistency (BASE), which utilizes 'Compensating Transactions' (undos) to resolve failures and eventually return the system to a valid state.
The Saga pattern is an alternative to the Two-Phase Commit (2PC) protocol. Since 2PC is often too slow and brittle for microservices, Sagas break a transaction into a series of local steps. If any step fails, the system must execute 'Compensating Transactions' to undo the effects of previous successful steps. This prioritizes high availability and scalability at the cost of transient 'data anomalies' where the system is temporarily inconsistent.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- 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)?
- You are modeling a 'Likes' counter for a global social network. You choose an AP model. What anomaly must your data model handle?