Video in progress
What is eventual consistency? How does a user experience it?
With eventual consistency, after a change the data in different services doesn't become the same instantly, but within a short time. The user sometimes notices this as "the update showed up a bit later".
📖 Answer
Example: you change your name in your profile. user-service updates immediately and emits a UserRenamed event. order-service keeps a copy of the customer name in its own table and processes this event a few seconds later. During those seconds the orders page shows the old name.
This isn't a bug; the system is designed this way. But you have to either hide it from the user or present it properly:
- read your own writes: show the user who made the change the response straight from the writing service;
- state it openly: an intermediate status like "payment is being processed";
- optimistic update in the UI: show the new value without waiting for server confirmation.
Where it isn't acceptable: for things like an account balance and a money transfer, "it'll be correct in a moment" isn't enough. There the data stays inside one service, with a strong transaction.
Sign up to mark studied questions and save your progress.