How to Split Services Effectively: Principles, Real Cases, and Domain Modeling
This article explains why overly fine‑grained service splitting hurts performance and debugging, shows best‑practice granularity aligned with team size, introduces evolutionary splitting based on model responsibilities, and walks through real‑world case studies, domain‑driven design concepts, architectural patterns such as hexagonal, CQRS, and event‑driven designs, and practical steps for building a robust service‑oriented system.
Splitting Principles
Overly fine‑grained service splitting leads to performance degradation and increased difficulty in locating problems.
Service Granularity Matching Team Size
Best practice: during the expansion phase, allocate one service per three developers; during the maintenance phase, two developers can manage multiple services.
Evolutionary Splitting Principle
Split based on model responsibilities (primarily business logic). Key focus points include data consistency after database splitting. The solution is to use eventual consistency instead of distributed transactions, implemented via a reliable event pattern (continuous retries) and a compensation pattern (compensate/rollback).
Real Case Analysis of Service Splitting
Key Issues for Splitting
How to Transform Structure into a Service‑Oriented Architecture
Identify Business Domains and Boundaries
Domain‑Driven Design Concepts
Domain models belong to the solution space. For example, a leave‑request system solves HR work‑hour problems (HR domain), while an e‑commerce platform solves consumer shopping problems (e‑commerce domain).
Benefits of domain‑driven design include handling system complexity, clearer boundaries, and better alignment with business needs.
Traditional Software Development Model
What Is Domain‑Driven Design?
Common Methods for Domain Modeling and Boundary Definition
Use‑case modeling: identify and express use cases, then derive domain concepts.
Steps for Use‑Case Modeling
Collect names, build classes and attributes, refine classes, add associations, and produce the final model.
Four‑Color Modeling
Distinguish problem, solution, and reality layers to clarify responsibilities.
Architectural Patterns
Classic Layered Architecture
Hexagonal Architecture
In hexagonal architecture, the domain layer is independent of technical layers; communication occurs through ports and adapters.
CQRS – Command Query Responsibility Segregation
Event‑Driven Architecture
E‑Commerce Domain Modeling Case Study
Define business middle‑platform, differentiate between middle‑platform and platform, and build a domain model to support business expansion.
Modeling stages include analysis, design, implementation, and iteration, using DDD tactical patterns such as aggregates, entities, value objects, domain services, and domain events.
Guidelines cover strategic modeling, tactical modeling, boundary context mapping, and evolution of the architecture.
Overall, the article provides a comprehensive guide to service splitting, domain‑driven design, and architectural patterns for building scalable, maintainable backend systems.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITFLY8 Architecture Home
ITFLY8 Architecture Home - focused on architecture knowledge sharing and exchange, covering project management and product design. Includes large-scale distributed website architecture (high performance, high availability, caching, message queues...), design patterns, architecture patterns, big data, project management (SCRUM, PMP, Prince2), product design, and more.
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.
