81. When would you choose strong consistency over eventual consistency?
Compare a balance update that must reject stale writes with a product-view counter that can converge later. Define the read and write contract, dependency on replica communication, behavior during failures, recovery or reconciliation, availability impact, and the user-visible tradeoff for each workload.
At a high level, I would choose strong consistency when stale data could cause a wrong result, such as updating an account balance. The main challenge is choosing between correctness and availability. I would explain two flows. Balance updates use an expected version, a leader, and a quorum before commit. Product-view events enter a durable stream and are counted later by workers. Strong consistency may reject writes during failures. Eventual consistency keeps the counter path more available, but users may temporarily see an older count.
The system handles two kinds of data with very different needs. A balance update must not silently overwrite a newer balance. A product-view count can be a little behind because an exact count is less critical. The diagram separates these needs into two paths. The balance path checks an expected version and commits through a replicated log. The product-view path accepts an event into a durable stream, then workers update the count in the background. This lets each workload choose the right balance between correctness and availability.
- Must every balance read return the latest committed value?
- Should a stale balance update return a conflict to the caller?
- How much delay is acceptable for product-view counts?
- During a failure, should balance writes fail rather than risk incorrect data?
I would say that consistency should be chosen for each kind of operation. The API Gateway handles authentication, authorization, validation, rate limiting, write idempotency, and audit logging. The Application Service then applies the consistency policy for the operation. For money, correctness is more important than accepting every write. For product views, temporary stale data is acceptable, so background processing is a better fit.
For a balance update, the Application Service sends an update with its expected version to the Strong Consistency Coordinator. The coordinator uses a leader and quorum, as shown by the Raft or Paxos example. It sends the proposed update to the Balance Store replicated log. The update commits only after the version check succeeds and a majority acknowledges it. If the expected version is stale, the update is rejected instead of overwriting newer data. Reads are linearizable, which means they reflect the latest committed balance.
If the coordinator cannot reach a quorum, the balance write fails or times out. This gives lower write availability during some failures, but it prevents an unsafe write from being committed. The Balance Store keeps the committed replicated log. After a leader failure, the system can choose a new leader and replay committed log state. The application does not need to merge conflicting committed balances because stale conflicting writes were rejected before commit.
For a product view, the Application Service sends work to the Ingestion Service. It appends an IncrementView event containing the product ID and timestamp. The event enters the durable, partitioned, replicated Log / Stream. Aggregator Workers consume accepted events and combine them per product. They update the Counter Store, which is a sharded key-value store or database in the diagram. The aggregate uses idempotent logic, which means retries do not incorrectly apply the same accepted work more than intended.
The request does not wait for counter aggregation or counter replicas. It can be acknowledged after the durable event-ingestion path accepts the event. During failures, counter processing may lag while ingestion can continue when that durable path remains available. Reads may show stale or partial counts, and monotonic reads are not guaranteed. Workers can retry accepted events and process them even when they arrive out of order. As that work completes, the stored count converges. The trade-off is clear: strong consistency protects critical balances, while eventual consistency gives the counter path higher availability and lets background work catch up later.
The benefit of strong consistency is that users see the latest committed balance and stale updates are rejected. This matters for money because an old write could cause real harm. The downside is lower availability. If a majority of replicas cannot communicate, a balance write may fail or time out. The product-view path makes a different choice. It can acknowledge a request after the durable event path accepts it, without waiting for the final count. This gives higher availability and keeps aggregation out of the request path. The downside is that users may temporarily see an older or partial count while workers catch up.
Interviewers ask this to see whether you choose consistency based on business risk instead of using one rule everywhere. They want to know if you understand stale writes, quorum communication, failure behavior, recovery, availability, and delayed background work. They also want to see whether you can explain why a balance needs stronger protection while a product-view counter can safely catch up later.










