March 26, 2024 4 min read A to Z Series: E Home

Eventual Consistency: Read the System Like a Timeline

Eventual consistency means replicas may disagree for a short time, but they converge when updates finish moving through the system.

I do not treat eventual consistency as a license to confuse users. I use it when the business can tolerate read delay, and I recommend making that delay visible in metrics and user experience.

The question is how long eventual takes

I use this section to force the failure case into the conversation, not just the clean path.

A profile picture can take seconds to appear everywhere. A payment status should not drift without a clear pending state. The architecture needs to show what was accepted, what is still propagating, and what users can safely do in the meantime.

Order status example

A practical example makes the hidden cost visible, especially around ownership and recovery.

A customer changes a shipping address. The write succeeds in the account service. Search and notification views update a few seconds later from events.

Reconciliation code

I use the code here to show the decision boundary, not just syntax.

A consumer updates a read model after the source write is complete:

void onAddressChanged(AddressChanged event) {
  searchView.updateAddress(event.customerId(), event.newAddress());
  notificationView.updateAddress(event.customerId(), event.newAddress());
}

The handler updates read models after the source event. The system accepts that search and notification views may lag, but they converge from the same event.

Sequence diagram: a change catches up

a change catches up The source of truth changes first. Other views become correct after they consume the event. sd a change catches up Customer Customer Account API Account API Event Bus Event Bus Search View Search View NotificationView NotificationView Save the new shippingaddress. Publish AddressChangedafter the write commits. Update the searchablecustomer record. Update the email template data.

The source of truth changes first. Other views become correct after they consume the event.

The user promise

Next consistency topics

Written by Arunkumar Ganesan.

What I learnt is that eventual consistency works best when the team names the lag instead of pretending it is invisible.

#DistributedSystems #EventualConsistency #EventDrivenArchitecture #Architecture