Chapter 5. Dealing with the Data
In this chapter, we’ll cover why microservices need to “own their own data” and what it means for your architecture. We will discuss when and how to use the the most important patterns for microservices data management: delegates, data lakes, Sagas, Event Sourcing, and command query responsibility segregation (CQRS). While discussing these important topics, we will also try to demonstrate them on practical examples using our sample project.
When it comes to practical microservices development, one of the early challenges that almost everyone hits is dealing with the data. If it wasn’t for the many challenges of data management in this space, turning complex, monolithic implementations into loosely coupled, “bite-sized,” manageable microservices would be fairly easy.
The design considerations for logical and physical models in microservices implementation are not the same as for designing data tables for the conventional, N-tier, monolithic applications. In this chapter we will see why the differences arise, which patterns the microservices practitioners commonly use, and what techniques should be employed to tackle the additional complexities we face when implementing microservices systems.
Independent Deployability and Data Sharing
In Chapter 4, we mentioned that Sam Newman suggests microservices should generally be:
-
Loosely coupled from each other; this also means independently deployable
-
Highly cohesive vis-à-vis capabilities inside the ...
Get Microservices: Up and Running now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.