पाठ 2 / 25

What Microservices Are

Define microservices by their key properties rather than their size.

Independently deployable services around business capabilities

Microservices structure an application as a set of small services, each independently deployable, organised around a business capability (catalogue, pricing, payments, shipping), owning its own data, and owned by one team. Services communicate over the network: synchronous APIs (HTTP/REST, gRPC) or asynchronous messages and events. The defining property is independent deployability: a team can change, test and release its service without coordinating a release with other teams. Size is secondary; "micro" refers to a focused responsibility, not lines of code. Microservices let organisations scale development across many teams, scale and choose technology per service, and contain some failures. They became popular through companies such as Amazon and Netflix in the 2010s, and they bring the full cost of distributed systems with them.

The same request across services

Each arrow is now a network call that can fail, time out or be slow, and there is no shared transaction.

client -> API gateway
  -> orders-service      POST /orders
       -> customer-service  GET  /customers/42        (network)
       -> pricing-service   POST /quotes              (network)
       -> inventory-service POST /reservations        (network, own DB)
       -> payments-service  POST /payment-intents     (network, own DB)
       publishes OrderPlaced -> notifications-service (async)

consistency across inventory, orders and payments now needs a saga,
not a database transaction

A food court instead of one restaurant kitchen

A monolith is one big kitchen: easy to pass dishes around, but everyone shares the stove and the head chef's schedule. Microservices are a food court: each stall runs its own kitchen and hours, but serving a combo meal means walking between stalls and coordinating.

त्वरित जाँच: Which property best defines a microservice?

  • It has fewer than 1,000 lines of code
  • It must be written in a different language from other services
  • It always uses Kubernetes
  • It can be deployed independently and owns its data and capability
Answer

It can be deployed independently and owns its data and capability — Independent deployability with clear ownership is the core property; size and tooling are secondary.