Data Architecture Design in Microservice Development
This article explains the multi‑layer data architecture design for microservice systems, covering concepts such as data usability, primary and secondary data decoupling, sharding, multi‑source data adaptation and caching, and introduces data marts to improve scalability and maintainability.
Microservices are a popular architectural style that enables small, atomic services with elastic scaling and high availability, allowing loose coupling between business domains and flexible system composition. This article shares design ideas and key points for data architecture within such a framework.
It outlines a simplified sales model consisting of customers, sellers, products, pricing, and orders, and demonstrates how these can be split into separate services (customer, seller, product, pricing, order, and common services such as authentication and notifications).
In a distributed architecture, the system is divided into SaaS, PaaS, and IaaS layers. Microservices embed vertically across these layers, requiring a data architecture that respects the concerns of each layer while preserving service independence.
The data architecture is layered from bottom to top as Raw Data, Logic Data (inner), and Logic Data (outer). Raw Data includes databases or files, Logic Data (inner) serves microservice APIs, and Logic Data (outer) provides data to external consumers.
Key Design Points
1. Data Usability – Data should be organized for easy consumption, e.g., splitting address information into separate tables and providing only necessary fields to external services.
2. Primary/Secondary Data and Decoupling – Identify core (primary) data for each service and reference (secondary) data from other services, using association tables to reduce coupling.
3. Database Sharding and Partitioning – Separate current, historical, and archive databases, and further shard by customer range; split tables (e.g., order header vs. order details) to control size and improve performance.
4. Multi‑Source Data Adaptation – Provide adapters for heterogeneous data sources (media files, CSV, XML, etc.) and a unified scheduling layer.
5. Multi‑Source Data Caching – Cache frequently accessed or immutable data in memory to reduce disk I/O and improve response times.
6. Data Mart – Build data marts for complex analytical needs, aggregating and cleaning data from multiple sources to support business intelligence scenarios.
Good data architecture makes business systems smoother, easier to understand, and maintainable. The article summarizes practical experiences for sharing with the community.
Architecture Digest
Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.