At the end of the year 2017 in this blog post, I wrote my goals for 2018. One of them was to read books I have on my to-read list. One of those books is “Migrating to Microservice Databases: From Relational Monolith to Distributed Data”. It’s a free book published by O’Reilly Media. You can get your copy here. I just finished reading this ebook and I want to share some of my thoughts with you.
This technical book is a quite short one (71 pages total). It’s written by Edson Yanaga – Red Hat’s Director of Developer Experience, who describes microservices architecture from the database point of view. As books title suggests, its main topic is migration strategies you can use to break huge monolith database into few smaller ones. Besides that, it also touches on the subject of zero downtime deployments.
High cohesion and loose coupling.
Microservice architecture assumes that each of developed services serves separate and specialized functionalities, but they all together form one product. On the other side, each service should be as much independent of others as possible. The situation becomes way more complicated when we start to consider services that use databases…
Each microservice should have its own separate database.
On the first look, databases do not seem to be a problem, but the longer we think about it, about the architecture, about data modifications, duplication, synchronization, and overall product performance, the more problems we can see. Databases may be separated, but data in most cases are common for some of the services.
I think this book is a good introduction to microservices’ databases topic. Especially for database specialists for whom this architecture may not be well known. It explains advantages and disadvantages of the microservices pattern, and stress problematic aspects of databases. The author lists the nine possible database migration strategies, from shared tables to virtual databases, and event sourcing, giving readers a lot of choice in what to implement. Each strategy is actually a data synchronization technique for multi-database environment that we can use in other scenarios – not only for microservices. The book explains well all their pros and cons. However, I need to admit that during the reading, I was missing detailed implementation examples for some hard cases (preferably with code samples).
Who is this book for?
If you already know microservices pattern and you work with databases that support microservices, then probably this book is not for you.
However, if you just were at a meeting where your boss announced that microservices architecture pattern is on the application roadmap and you have no idea what he is talking about, then you should consider reading this book as soon as possible. Maybe it will not equip you with ready-to-implement solutions, but it will give you a general idea of what is possible for your databases.