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.
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
- KubernetesKubernetes is a container orchestration system that deploys, scales and heals applications across a cluster of servers.
- DockerDocker packages an application with its dependencies into a container that runs the same on a laptop, a server and the cloud.
- gRPCA remote procedure call framework on HTTP/2 and Protocol Buffers for fast service-to-service communication.
- Apache KafkaKafka is a distributed event log for high-throughput data streaming with durable storage.
- OpenTelemetryA single open standard and SDK set for traces, metrics and logs, independent of the vendor.
- JaegerA distributed tracing system: it collects and shows the path of a request through microservices.
- PrometheusA monitoring system with a time series database: it scrapes metrics in a pull model and offers the PromQL query language.
- Spring BootAn opinionated layer over Spring for Java and Kotlin with auto-configuration and one-command startup.
- GoA simple compiled language with built-in concurrency for network services and infrastructure.
Related topics
Sources
Logos belong to their owners and are used for identification only. Icons: Simple Icons (CC0), Devicon (MIT).