Chapter 5. Data ownership and data storage
This chapter covers
- Exploring microservices and their data stores
- Understanding how data ownership follows business capabilities
- Using data replication for speed and robustness
- Building read models from event feeds with event subscribers
- Understanding how microservices store data
Software systems create, use, and transform data. Without the data, most software systems wouldn’t be worth much, and that’s true for microservice systems. In this chapter, you’ll learn where a piece of data should be stored and which microservice should be responsible for keeping it up to date. Furthermore, you’ll learn how you can use data replication to make your microservice system both more robust and faster.
One of the characteristics of microservices identified in chapter 1 is that each microservice should own its data store. The data in that data store is solely under the control of the microservice, and it’s exactly the data the microservice needs. It’s primarily data belonging to the capability the microservice implements, but it also includes supporting data, like cached data and read models created from event feeds.
The fact that each microservice owns a data store means you don’t need to use the same database technology for all microservices. You can choose a database technology that’s suited to the data that each microservice needs to store.
A microservice typically needs to store three types of data: