Lesson 5 of 17
27. Monolith vs Microservices

27.4 What are microservices?

3 min read+10 XP

In the restaurant: A food court. Each stall is its own business: own staff, own pantry, own hours, own menu changes. The dosa stall can add a new dosa today without telling anyone.

In the system: In a microservices architecture, the application is split into small services, each:

  • Owning one business capability (orders, payments, catalogue).
  • Deployed independently, on its own schedule.
  • Owning its own data (27.9).
  • Talking to others over the network: HTTP/gRPC APIs (Chapter 24) or events (Chapters 22 and 23).
  • Owned by one team that builds and runs it.

What you gain:

  • Independent deploys: the payments team ships five times a day without waiting for search.
  • Independent scaling: run 50 copies of search and 3 of payments.
  • Fault isolation, if designed well: recommendations being down shouldn't stop checkout.
  • Technology choice per service: search in one language with Elasticsearch, payments in another with PostgreSQL.
  • Team autonomy: teams own outcomes end to end. (Conway's law: systems end up mirroring the communication structure of the organisation that builds them.)

Memory code: "Each stall runs itself, from pantry to counter."