Storing Service Data
In this chapter, we are going to review a very important topic: storing service data in persistent databases. In the previous chapters, we stored movie metadata and user ratings using in-memory repositories. While it was easy to implement in-memory storages of our data, using them would be impractical due to many reasons. One such reason is a lack of a persistence guarantee: if our service instances storing the data were restarted (for example, due to application failure or on host restart), we would lose all our data that was stored in the memory of a previously running instance. To guarantee that our data won’t be lost over time, we need a solution that can persist our data and allow us to read and write it to our microservices. Among such solutions are databases, which we are going to review in this chapter.
We will cover the following topics:
- Introduction to databases
- Using MySQL to store our service data
Let’s proceed to...