Bookmarks

Microservices

An architectural style in which an application is assembled from small independent services: each service is deployed separately, and each has its own database.

Also: microservices architecture, microservice, microservice architecture, MSA

checked 8 Nov

All terms

Microservices are a way to break a large system into many small services, each of which lives its own life: separate deployment, separate database, its own part of the business. The style grew as a response to large monoliths that become hard to change as the code and the number of teams grow.

Key characteristics

CharacteristicWhat it means in practice
Independent deploymenta service is released and rolled back on its own: a change to one service does not require a system-wide release
Own databasea service owns its data, and neighbours access it through its API rather than reading other services’ tables
Business boundarya service is responsible for one part of the business — the catalogue, payments, delivery — and can sensibly be replaced as a whole
Simple channelsthe logic lives in the services themselves, and a simple transport connects them: HTTP or a message queue
Designed for failureservices communicate over a network that can fail, so each one survives the crashes and slowness of its neighbours

Origin of the term

The word microservice was discussed at a meeting of architects near Venice in May 2011, the same group chose the name microservices in May 2012, and the style became widely known after James Lewis and Martin Fowler’s 2014 article. The authors were not describing a plan for the future but an approach that large companies were already using by then.

The cost of the approach

In exchange for independence, the system becomes distributed, and that means the inherent complexity of distributed computing. A system of ten services is ten databases and ten release pipelines instead of one; a request travels over the network, where delays and failures are possible, and a single transaction cannot span several services, so data converges eventually. There is also more observability work: logs, metrics and traces have to be collected across all services at once.

So before splitting a system into services, teams usually check that they are ready:

  • the team can work with release automation and operations; without this, services quickly turn into a distributed monolith;
  • clear service boundaries have been chosen — usually along the bounded contexts of the domain;
  • it is clear how services will find each other and how a client will reach a set of services — usually through an API gateway.

Sources

the term is written from these pages

Verified 8 Nov

Not to be confused with

what it is mixed up with and how it differs

  • monolith

    A monolith is a single deployable unit with shared code and database; microservices split the system into services with separate releases.

  • modular monolith

    A modular monolith keeps strict module boundaries inside one application; in microservices the boundary runs over the network.

  • distributed monolith

    A distributed monolith looks like microservices, but the services cannot be released separately: they share a single release and a single failure.

In depth in the references

where the topic is covered in detail