What is microservices architecture? Microservices is a way of building an application as a set of small, independent services, each responsible for one business capability, running in its own process and communicating through well-defined APIs. Instead of one large codebase that must be built, tested and deployed as a single unit, teams own and release their services separately. This guide explains what microservices are, how they work, the benefits and costs, how they compare with a monolith, and when they are the right choice.
Short answer: Microservices split an application into small services that can be developed, deployed and scaled independently. They bring speed and resilience at scale, and they bring real operational complexity, so they suit teams and systems that have outgrown a monolith.
What is microservices architecture?
Microservices are an architectural style in which an application is composed of loosely coupled services. Each service owns its data and logic for a single business capability, such as orders, payments, inventory or notifications, and exposes it through an API. Services talk to each other over the network, using synchronous calls such as REST or gRPC, or asynchronous messages and events.
The word "micro" refers to focus, not lines of code. A good service is small enough for one team to understand fully, and large enough to deliver a complete piece of business value.
Monolith vs microservices

| Factor | Monolith | Microservices |
|---|---|---|
| Structure | One codebase and deployable unit | Many small independent services |
| Deployment | Whole application at once | Each service separately |
| Scaling | Scale the entire application | Scale only the busy services |
| Technology | One stack, usually | Different stacks possible per service |
| Data | One shared database | Each service owns its data |
| Failure | One fault can bring the app down | Faults can be contained to a service |
| Complexity | Simple to start, hard to change at scale | Complex to operate, easier to change locally |
| Best for | Small teams, early products | Large systems and many teams |
A monolith is not a mistake. For a new product and a small team, it is often the faster and cheaper choice. Many successful systems start as a well-structured monolith and extract services only when the pain justifies it.
How microservices work
- Decompose by business capability. Each service maps to something the business does, not to a technical layer.
- Expose an API. Other services and clients call it through a stable, versioned contract. See what is an API.
- Own the data. A service keeps its own datastore and shares data only through its API or events.
- Communicate. Synchronous calls for immediate answers; asynchronous events for loose coupling.
- Deploy independently. Each service has its own pipeline, built and released without waiting for others.
- Observe everything. Logs, metrics and distributed traces show how a request moves across services.
Key components of a microservices system
- API gateway: a single entry point that routes requests, authenticates callers and applies limits. See what is an API gateway.
- Service discovery: lets services find each other as instances start and stop.
- Containers and orchestration: services are usually packaged in containers and run on Kubernetes.
- Message broker or event bus: carries asynchronous messages between services.
- Centralised observability: logging, metrics and tracing across all services.
- CI/CD pipelines: one per service. See what is a CI/CD pipeline.
Benefits of microservices
- Faster delivery: small teams ship their own service without coordinating a company-wide release.
- Scalability: scale the checkout service for a sale without scaling the whole shop.
- Resilience: a failing recommendation service need not stop payments.
- Technology freedom: use the best tool for each job, within sensible limits.
- Clear ownership: a team that owns a service owns its quality and uptime.
Challenges of microservices
The same independence that gives microservices their strengths also creates costs that a monolith does not have.
- Distributed complexity. Network calls fail, time out and arrive late. Every call needs timeouts, retries and sensible fallbacks.
- Data consistency. With no shared database, a business transaction spanning several services needs patterns such as sagas rather than a single database transaction.
- Operational overhead. Dozens of pipelines, environments and dashboards need strong automation and DevOps practices.
- Testing. End-to-end tests across services are slow and fragile. Contract tests help.
- Wrong boundaries. Poorly chosen services chat constantly and form a "distributed monolith" with the worst of both worlds.
Microservices do not remove complexity. They move it from the code into the network, and the team must be ready to run it there.
Common microservices patterns
| Pattern | Purpose |
|---|---|
| API gateway | One entry point for clients, handling routing, security and limits |
| Circuit breaker | Stops calling a failing service so failures do not cascade |
| Saga | Coordinates a business transaction across services with compensating steps |
| Event sourcing and CQRS | Stores changes as events and separates read and write models |
| Strangler fig | Gradually replaces a monolith by routing features to new services |
| Sidecar and service mesh | Moves cross-cutting concerns such as security and tracing into infrastructure |
A microservices example: online shop
Consider an online shop. In a monolith, catalogue, basket, checkout, payments and notifications live in one application and one database. In a microservices design, each is its own service. When a customer places an order, the checkout service calls the payment service and publishes an "order placed" event. Inventory, shipping and notification services each react to that event in their own time. If the notification service is down for ten minutes, orders still complete and the messages are sent when it recovers. During a sale, the team scales only checkout and payments, not the whole system.
Security and testing in microservices
More services mean more network surface. Authenticate every service-to-service call, ideally with mutual TLS or signed tokens, and keep secrets in a secrets manager. Apply the same input validation to internal APIs as to public ones. For testing, rely on a pyramid: many fast unit tests, a smaller set of contract tests that verify each service honours the agreement its consumers expect, and a few end-to-end tests for critical journeys. Contract testing catches breaking changes without needing every service running at once.
When should you use microservices?
Consider microservices when several teams work on one product and block each other, when parts of the system have very different scaling needs, when you need to release some features far more often than others and when you already have strong automation and monitoring. Avoid them for a new product with a small team, an unclear domain or limited operational maturity. A modular monolith, with clear internal boundaries, is an excellent starting point and keeps the option to split later.
How to migrate from a monolith
- Understand the domain. Map business capabilities and find natural boundaries.
- Modularise first. Clean up the monolith so modules have clear interfaces.
- Extract one service. Start with a capability that changes often or has clear scaling needs.
- Use the strangler pattern. Route traffic to the new service gradually while the old code remains as a fallback.
- Build the platform. Pipelines, monitoring and gateway before extracting more.
- Repeat and retire. Continue service by service and remove old code as it becomes unused.
Our DevOps service, cloud migration service and API development service support teams through this journey, from boundary design to pipelines and operations. For integration between services and legacy systems, see our system integration service.
Key takeaways
- Microservices build an application from small, independently deployable services.
- Each service owns one business capability and its data.
- They enable team autonomy and targeted scaling, but add operational complexity.
- Gateways, orchestration, messaging and observability are required building blocks.
- A modular monolith is often the best start; extract services when the need is clear.
Quick glossary
| Term | Meaning |
|---|---|
| Service boundary | The line around one business capability |
| Saga | A sequence of local transactions with compensating actions |
| Circuit breaker | A guard that stops calls to a failing service |
| Service mesh | Infrastructure layer handling service-to-service traffic |
| Distributed monolith | Services so tightly coupled they must change together |
Read next: Lead Nurturing: Strategy, Tactics and Examples · Data Quality: Dimensions, Causes and How to Improve It · What Is a Data Pipeline? Components, Types and Examples
Frequently asked questions
What is microservices architecture in simple terms?
It is a way of building an application as many small services, each handling one business function and communicating through APIs, so each can be developed, deployed and scaled on its own.
What is the difference between monolith and microservices?
A monolith is one codebase deployed as a single unit. Microservices split the application into independent services with their own data and deployments. Microservices scale and change more flexibly but are harder to operate.
What are the advantages of microservices?
Independent deployment, targeted scaling, fault isolation, team autonomy and the freedom to choose suitable technology for each service.
What are the disadvantages of microservices?
Distributed system complexity, harder testing, data consistency challenges, higher operational overhead and the risk of poorly chosen service boundaries.
How do microservices communicate?
They communicate over the network, using synchronous protocols such as REST or gRPC for immediate responses, or asynchronous messaging and events through a broker for loose coupling.
Do microservices need Kubernetes?
Not strictly, but containers and an orchestrator such as Kubernetes are the most common way to run many services reliably, handling scaling, restarts and networking.
When should I not use microservices?
Avoid them for small teams, early products with unclear domains, or organisations without strong automation and monitoring. A well-structured monolith is usually faster and cheaper to start.
What is an API gateway in microservices?
An API gateway is the single entry point for clients. It routes requests to the right service and handles authentication, rate limiting and monitoring, hiding the internal structure from consumers.
