What Is a Microservice? Architecture Explained with Examples
A microservice is a small, independent piece of software that does one job well, as part of a larger application. Instead of building an entire system as one big program, you build it as a collection of small services — one for user accounts, one for payments, one for search, one for orders — each running on its own, each able to be updated, scaled, or fixed without touching the others. They talk to each other over a network, usually through APIs.
The idea became popular in the 2010s, when companies like Netflix, Amazon, and Uber rebuilt their systems this way after their single large programs — called monoliths — became too slow to change. The term itself was popularised by software architects Martin Fowler and James Lewis in a 2014 article that gave the style its name and its rules. This guide explains what a microservice is, how it differs from a monolith, why companies choose it, and when it is the wrong choice.
Microservice vs Monolith: The Core Difference
Imagine a restaurant. A monolith is a single kitchen where one team cooks every dish, shares every tool, and if the oven breaks, the whole kitchen stops. A microservices kitchen is a row of small specialist kitchens — one for grills, one for salads, one for desserts — each with its own tools and its own team. If the dessert kitchen has a problem, the grill kitchen keeps working.
In software, a monolith is one program that contains everything: the user interface, the business rules, the database access, and all the features. You deploy it as one unit. A change to one small feature means rebuilding and redeploying the whole thing — a bit like how a single browser cookie can carry a whole set of preferences in one small file. A microservices system splits the same features into separate services, each with its own codebase and often its own database. You deploy each service on its own, and a change to the payments service does not touch the search service at all.
Neither style is good or bad on its own. A monolith is simpler, and for a small application it is usually the right choice. Microservices pay off when an application gets large enough that one team can no longer hold the whole thing in their heads, or when different parts of it need to grow at very different speeds.

The Rules Every Microservice Follows
Not every small program is a microservice. The style has a few rules that separate it from simply chopping a system into pieces.
Each service does one thing. A microservice is built around one business capability — payments, or user profiles, or product search — and it does that one thing well. If a service starts doing three unrelated jobs, it is not a microservice any more; it is a small monolith.
Each service is independently deployable. You can update, restart, or replace one service without redeploying the rest. This is the rule that makes microservices valuable: a team can ship a fix to the checkout service on a Friday afternoon without asking every other team to stop work.
Services talk through clear interfaces. Microservices communicate over the network, usually with HTTP APIs or message queues — the same kind of standardised feed idea behind an RSS feed, where one system publishes in a format another system can read. They do not share each other’s internal code or databases directly. The interface — what a service accepts and what it returns — is a contract, and as long as the contract holds, the service behind it can change freely.
Each service owns its data. In a well-designed microservices system, each service has its own database. The orders service does not read the users service’s tables directly; it asks the users service for what it needs. This keeps services independent, but it also means there is no single database to query across the whole system — a trade-off we will come back to.
Failure is contained. If one service crashes, the others keep running. The system is designed so that the failure of the recommendations service, for example, means the shop shows no recommendations — not that the whole shop goes down. This is called fault isolation, and it is one of the main reasons large companies adopt the style.
A Real Example: An Online Shop
Take an online shop with a million customers. As a monolith, it is one program handling the catalogue, the shopping cart, checkout, payments, orders, delivery tracking, reviews, and user accounts. When the marketing team wants a new feature for the product pages, the developers must rebuild and redeploy the entire shop, including the payment code they did not touch.
As microservices, the same shop looks like this: a catalogue service, a cart service, a checkout service, a payments service, an orders service, a delivery service, a reviews service, and a users service. Each has its own team, its own release schedule, and its own database.
On a sale day, the catalogue service gets ten times its normal traffic while the reviews service barely moves. With microservices, you scale up only the catalogue service — adding more copies of it — instead of scaling the whole shop. If the payments service needs a security fix, you deploy it in minutes without touching the product pages. And if the reviews service crashes, customers can still buy things; they just cannot read reviews for a while. All of this depends on the network between services holding up — and as faster mobile and broadband networks spread, that part gets easier, as our guide on what 5G is and how it works explains.
This is why the big companies moved. Netflix, for example, famously rebuilt its system as hundreds of microservices so that a failure in one part — a recommendation engine, a billing service — never takes down the streaming that customers are watching. Amazon’s teams work the same way: each team owns a service, and the services are the building blocks of the whole store.
Monolith vs Microservices, Side by Side
| Factor | Monolith | Microservices |
|---|---|---|
| Structure | One program, one codebase, one deployment | Many small services, each deployed separately |
| Team size that fits | Small team, one team can own it all | Many teams, each owning one or a few services |
| Changing one feature | Rebuild and redeploy the whole application | Deploy only the service that changed |
| Scaling | Scale the whole application, even the quiet parts | Scale only the busy services |
| Failure | A crash can take down everything | Failure is contained to one service |
| Technology choice | One language and stack for everything | Each service can use the best tool for its job |
| Debugging | Simple — everything is in one place | Hard — a request crosses many services and networks |
| Data | One database, easy to query across the system | Many databases, no single place to query everything |
| Getting started | Fast and simple | Slow — needs deployment, monitoring, and networking from day one |
The table makes the trade-off plain. Microservices buy you independence, scaling, and fault isolation — and you pay for it with complexity. That complexity is real: instead of one program to monitor, you have dozens; instead of one database to back up, you have many; instead of a function call, every interaction is a network request that can be slow or can fail.
That is why the advice from Martin Fowler, one of the people who defined the style, is to start with a monolith and split it later, when the pain of staying together is greater than the cost of splitting apart. Starting with microservices on day one is one of the most common mistakes in software architecture.

When Microservices Are the Right Choice
Microservices are worth the complexity when several of these are true. You have multiple teams, and they keep stepping on each other’s work in one shared codebase. Different parts of your system grow at very different rates — your search traffic is ten times your checkout traffic. You need to deploy some parts far more often than others. You need one part to stay up even when another part fails. Or different parts genuinely need different technologies — a machine-learning service in Python next to a payments service in Java.
Large, successful systems that fit this pattern include Netflix’s streaming platform, Amazon’s store, Uber’s ride matching, and most large banks’ online services. They all reached microservices after outgrowing a monolith, not before.
When Microservices Are the Wrong Choice
Microservices are the wrong choice when your application is small, your team is small, or your domain is not yet understood. A startup with five developers and one product will move faster with a monolith, because every feature is in one place and a change takes minutes to ship. A system whose requirements change every week is also a bad fit, because splitting a system into services requires knowing where the boundaries are — and if you draw the boundaries wrong, you will pay for it in endless cross-service changes.
The honest rule is this: if you cannot yet say clearly what the services should be, you are not ready for microservices. Build the monolith, keep it tidy, watch where the natural seams form, and split along those seams when they appear. The microservices you build from a real monolith are almost always better than the ones you design on a whiteboard before writing any code.
The Hard Parts Nobody Mentions First
Three problems catch every team that adopts microservices. First, distributed data: with no single database, a report that used to be one query becomes a job that pulls data from ten services and stitches it together. Second, observability: when a user reports an error, you have to trace one request through many services, across a network, to find which one failed — which needs logging and tracing tools a monolith never required. Third, network failure: inside a monolith, calling another part of the program always works; between microservices, the call can time out, fail, or arrive twice, and every service must be written to handle that.
None of these is a reason to avoid microservices. They are reasons to adopt them deliberately, with eyes open, and with the tooling — monitoring, logging, automated deployment, and service discovery — in place before the services multiply.
Frequently Asked Questions
What is a microservice in simple terms?
A microservice is a small, independent program that does one job — like handling payments or managing user accounts — as part of a bigger application. Many microservices work together, talking to each other over a network, to make up the full system.
What is the difference between a microservice and an API?
An API is the interface a service offers to the outside world — the set of requests it accepts and the responses it returns. A microservice is the service behind that interface. One microservice usually exposes one API, and other services call that API to use it.
Are microservices better than a monolith?
Not always. Microservices are better for large systems with many teams, uneven growth, and strict uptime needs. A monolith is better for small applications and small teams, because it is simpler to build, test, and run. Most experts recommend starting with a monolith and splitting it only when it becomes painful to keep together.
Do microservices need containers?
They do not require containers, but containers — usually Docker, managed by Kubernetes — are the standard way to run them, because each service needs to be deployed, scaled, and restarted independently, and containers make that practical at scale.
What companies use microservices?
Netflix, Amazon, Uber, and most large banks and streaming services run on microservices. They adopted the style after their monoliths became too large and slow to change, and they now run hundreds or thousands of services each.





