Architecture 2025-02-17

How to Split a Large Monolith? - Lessons from Software Architecture Hard Parts

This article organizes useful points for considering service division from a monolith, based on chapters 1 to 4 of 'Software Architecture: The Hard Parts'.

Read in: ja
How to Split a Large Monolith? - Lessons from Software Architecture Hard Parts

In this article, we organize useful points for considering service division from a monolith, based on chapters 1 to 4 of Software Architecture: The Hard Parts.

There is no "silver bullet" that applies to all organizations, but understanding "what trade-offs to identify" might help in designing a more convincing architecture.

1. There is No "Best Practice" — Identifying Trade-offs

1.1 Why There is No "Silver Bullet"

1.2 Utilizing ADR (Architecture Decision Record)

2. Architecture Quantum — How Much is a "Chunk"?

In Software Architecture: The Hard Parts, the concept of Architecture Quantum is emphasized.

Architecture Quantum: A unit that can be "independently deployed" and has "high functional cohesion, with elements strongly coupled both statically and dynamically."

Coupling refers to dependency relationships where changes in one affect the other.

Cohesion refers to the degree to which related elements are grouped together, with higher cohesion when grouped for the same purpose.

2.1 Examples of Static and Dynamic Coupling

2.2 Factors Leading to Large Quanta

3. Why Aim for Service Division — Drivers of Modularization

3.1 Maintainability and Testability

3.2 Deployability and Scalability

3.3 Availability and Fault Tolerance

4. Division Approach — How to Split a Monolith

4.1 Component-Based Decomposition Steps

  1. Modularize the Monolith
    • First, visualize existing code dependencies.
    • Find "components" through layering and package splitting.
  2. Consider Database Splitting
    • If possible, organize by table or schema unit, aiming for independent DBs per service.
    • To reduce migration risk, first logically separate schemas, then physically separate DBs.
  3. Create a State for Independent Service Deployment
    • Gradually build CI/CD pipelines, enabling each service to be tested and deployed independently.
    • A full microservices transition can be confusing, so a small start is recommended.

4.2 Cautions for Tactical Forking

5. Technical Checklist When Challenging Service Division

  1. Trade-off Analysis
    • Determine the priority of key elements (performance, availability, security, cost, etc.).
    • Preconceiving which elements can be sacrificed helps stabilize decision-making.
  2. Understanding Architecture Quantum
    • Confirm whether services can operate independently, and whether shared DBs or synchronous calls are "bottlenecks."
  3. Gradual Implementation
    • Large-scale refactoring is risky, so start with modularization.
    • Data layer decomposition planning, such as table design splitting and using multiple DBs, is crucial.
  4. Clarify Priorities for Maintainability and Scalability
    • Share within the team and with management "what operational structure will be after division" and "what level of fault tolerance is needed."

5. Conclusion

There is no universal solution for service division, but understanding trade-offs and identifying optimal architecture quanta allows for gradual execution.

Architectural changes take time, so it's important to start with small steps.

Tags: Architecture Strategy Monolith Microservices
Share: 𝕏 Post Facebook Hatena
✏️ View source / Discuss on GitHub
☕ Support

If you enjoy this blog, consider supporting it. Every bit helps keep it running!


Related Articles