Architecture style

Microservices

A system of many small services, each with its own database and independent deploys. It solves the large team problem at the cost of complex operations.

Microservices: a gateway at the edge, each service with its own databasegRPCClientsAPI gatewayCatalog serviceOrders servicePayments serviceCatalog DBOrders DBPayments DB
Microservices: a gateway at the edge, each service with its own database

What makes a service a microservice

A microservice owns one business capability (catalog, orders, payments), has its own data store and deploys independently of the others. Code size is secondary: what matters is that a team can ship its service without coordinating with five others.

Services talk over the network: synchronously via HTTP/REST or gRPC, asynchronously via a message broker. A database shared between services is an anti-pattern, because it ties them back into a distributed monolith.

The price of the network

Every call between services can fail, stall or be repeated. So you need timeouts, retries with backoff, circuit breakers and idempotent operations. If one user request goes through a chain of 6 services at 99.9% availability each, overall availability drops to about 99.4%.

Transactions across services are not possible in the classic sense. Orders and payments are coordinated through a saga: a sequence of local transactions with compensations (cancel the order if the payment failed). Data becomes consistent not instantly, but within seconds.

What you need to run them

The minimum set: containers and an orchestrator (Docker, Kubernetes), CI/CD per service, centralized logs, metrics and distributed tracing (OpenTelemetry, Jaeger), service discovery and an API gateway at the edge.

Without tracing, debugging becomes a search through ten log files. Without a platform team, every product team reinvents deployment. That is why microservices pay off when you have dozens or hundreds of engineers, not five.

When they are worth it

Netflix moved to microservices on AWS after a serious monolithic database failure in 2008 and finished the migration in 2016. Hundreds of services let hundreds of teams deploy independently and scale hot paths separately.

The counterexample: in 2018 Segment merged more than a hundred integration services back into one, because maintaining each separately cost more than it gave. Microservices solve an organizational problem, not a technical one.

Pros

  • Teams deploy independently, dozens of releases a day.
  • Each service scales separately for its own load.
  • Failure isolation: recommendations going down does not break checkout.
  • You can pick the language and database that fit each service.

Cons

  • Network calls add latency and new failure modes.
  • No transactions across services: sagas and eventual consistency.
  • Requires a mature platform: orchestration, tracing, CI/CD per service.
  • Debugging and local development are much harder.
  • Wrong service boundaries are expensive to fix.

When to choose it

  • You have dozens of engineers who truly block each other in shared code.
  • Parts of the system have very different load or availability needs.
  • There is a platform team or a budget for managed infrastructure.
  • Domain boundaries are already proven (for example, in a modular monolith).

Where it is used

  • Netflix: migration from its own data center to microservices on AWS, completed in 2016.
  • Segment: merging more than a hundred integration services back into one in 2018.

Tools

Sources

Logos belong to their owners and are used for identification only. Icons: Simple Icons (CC0), Devicon (MIT).