Skip to main content

Monolith VS Microservice

Monolith

  • Single App, everything inside, UI, backend, database, etc.
  • Advantages:
    • Simplified architecture.
    • Less time worrying the complexity of distributed systems.
    • Less time worrying about deployment of the system.
  • Disadvantages:
    • Scalability, hard to scale.
    • Sometimes hard to debug. For example memory leak happened in Netflix early days.
    • If one part of the program is down, then everything is down.

Microservice

  • Approach to develop single application as a suite of small services. Each running its own process and communicating with lightweight mechanism.
  • Advantages:
    • Separation of concerns.
    • Modularity and encapsulation.
    • Scalability, easy to do horizontal scaling and workload partition.
    • Virtualization: It is recommended to use virtual environment for less complex deployment (on demand resource & auto scaling).
  • Disadvantage:
    • Much more complex to build.
    • Prone to network partition, see [[cap_theorem]] for more detail.