Microservice and Containerization Patterns > State & Data Access Patterns > Centralized Isolated State Repository
Centralized Isolated State Repository (Erl, Naserpour)
How can solution-wide state be consistently provided when each microservice has its own dedicated state database?
A master state repository is positioned as the “single source of truth” because all microservices publish their state data to it in addition to recording it locally. This establishes an effective state tracking system that is isolated and resides outside of other microservice boundaries.
The microservices write the changes of the state updates in the external source of truth, which can track entire state changes and does not belong to any one microservice. All state updates are available in a location that can be queried in realtime, and can now be used to query the state of individual microservices or the solution as a whole.
This pattern can be applied in conjunction with the Microservice Layers pattern as explained in the complete pattern description.