“Cold data” in central databases. For complex reports and queries that might not require real-time
data,
a common approach is to export your “hot data” (transactional data from the microservices) as
“cold data” into large databases that are used only for reporting. That central database system can be
a Big Data-based system, like Hadoop, a data warehouse like one based on Azure SQL Data
Warehouse, or even a single SQL database that’s used just for reports (if size won’t be an issue).
Keep in mind that this centralized database would be used only for queries and reports that do not
need real-time data. The original updates and transactions, as your source of truth, have to be in your
microservices data. The way you would synchronize data would be either by using event-driven
communication (covered in the next sections) or by using other database infrastructure import/export
tools. If you use event-driven communication, that integration process would be similar to the way
you propagate data as described earlier for CQRS query tables.
However, if your application design involves constantly aggregating information from multiple
microservices for complex queries, it might be a symptom of a bad design -a microservice should be
as isolated as possible from other microservices. (This excludes reports/analytics that always should
use cold-data central databases.) Having this problem often might be a reason to merge
microservices. You need to balance the autonomy of evolution and deployment of each microservice
with strong dependencies, cohesion, and data aggregation.
Challenge #3: How to achieve consistency across multiple microservices As stated previously, the data owned by each microservice is private to that microservice and can only
be accessed using its microservice API. Therefore, a challenge presented is how to implement end-to-
end business processes while keeping consistency across multiple microservices.
To analyze this problem, let’s look at an example from the
eShopOnContainers reference application
.
The Catalog microservice maintains information about all the products, including the product price.
The Basket microservice manages temporal data about product items that users are adding to their
shopping baskets, which includes the price of the items at the time they were added to the basket.
When a product’s price is updated in the catalog, that price should also be updated in the active
baskets that hold that same product, plus the system should probably warn the user saying that a