Microservices Use Cases
Moving beyond the theory to understand when and why you should use a microservices architecture. Microservices are powerful, but they are not the right choice for every project. This guide shows where they shine, with real-world use cases from several industries, a complete e-commerce example, small practical code examples, and an honest look at when a simpler architecture is the better choice.
1. What Are Microservices?
Before diving into the use cases, let us quickly define microservices. Imagine a large monolithic application as a single, massive container holding all the code for every feature. Microservices break this container into a collection of smaller, independent and loosely coupled services.
Each service is responsible for one business capability, has its own data, and can be developed, deployed and scaled independently. For a full introduction, see Microservices Introduction.
2. Signs Your Project Needs Microservices
Microservices usually pay off when several of these statements are true:
| Sign | Why microservices help |
|---|---|
| Releases are slow because every change needs the whole application to be tested and deployed | Each service can be released on its own |
| Many teams work in the same codebase and block each other | Each team owns its own services |
| One feature gets far more traffic than the rest | Only that service needs to scale |
| A bug in a minor feature can crash the entire system | Failures stay inside one service |
| Different parts of the system have very different technical needs | Each service can use the best tools for its job |
| The business has clear, separate areas, such as orders, payments and shipping | These areas become natural service boundaries |
If none of these apply, a well-structured monolith is usually simpler, cheaper and faster to build.
3. Key Use Cases for Microservices Architecture
Microservices are a powerful architectural style, but not a one-size-fits-all solution. They shine brightest in these scenarios:
3.1 Complex and evolving applications
When a large, complex application needs frequent updates and new features, a monolith can become a bottleneck. With microservices, different teams work on different services at the same time without stepping on each other’s toes, which speeds up development and time to market.
3.2 Scalability at a granular level
In a monolith, you scale the entire application even if only one feature is under heavy load. With microservices, you find the service under pressure, such as payment processing during a sale, and scale only that service. This uses resources more efficiently and saves money.
3.3 Technology diversity
Different problems are best solved with different tools. Each team can choose the most suitable language, framework and database for its service. An order service might use Java and a relational database for transactional safety, while a recommendation service might use Python and a graph database for its algorithms.
3.4 High availability and fault isolation
A failure in one small part of a monolith can bring down the whole system. In a microservices architecture, failures are contained: if the notification service fails, login and order processing keep working. The system as a whole becomes more resilient.
3.5 Long-term team scalability
As engineering teams grow, coordinating work on one codebase becomes hard. Microservices fit Conway’s Law, the observation that systems tend to mirror the structure of the teams that build them. You can organize teams around business areas, such as a Checkout team and a Search team, which improves ownership and autonomy.
4. Microservices Use Cases by Industry
| Industry | Typical services | Why microservices fit |
|---|---|---|
| E-commerce and retail | Catalog, search, cart, orders, payments, shipping, recommendations | Huge traffic spikes during sales; many teams; frequent feature releases |
| Banking and fintech | Accounts, payments, cards, fraud detection, loans, notifications | Strict isolation of sensitive functions; independent compliance and audits; high availability |
| Media and streaming | User profiles, catalog, playback, recommendations, billing | Massive, uneven load; personalization that changes quickly; global scale |
| Ride-hailing and delivery | Riders, drivers, matching, pricing, routing, payments | Real-time processing; each part scales with different demand |
| Travel and booking | Search, availability, booking, pricing, partner integrations | Many external partners; search load far higher than booking load |
| Healthcare | Patients, appointments, records, billing, telemedicine | Strong data separation and access control; integration with many systems |
| SaaS platforms | Tenants, users, billing, core product features, integrations | Many customers with different usage; independent feature development |
| IoT and telematics | Device registry, data ingestion, analytics, alerts | Huge streams of incoming data; ingestion must scale separately from analytics |
5. A Detailed Example: The E-Commerce Platform
Let us make this concrete with a simplified e-commerce platform. In a monolith, all of these features would be tangled together in one codebase. In a microservices architecture, we break it down:
| Service | Responsibility |
|---|---|
| User service | User accounts, login and profiles |
| Product catalog service | Product information, stock levels and categories |
| Order service | Coordinates the whole order process |
| Payment service | Talks to external payment providers |
| Shipping service | Calculates shipping costs and creates shipping labels |
| Notification service | Sends emails and text messages to customers |
Web / Mobile app
|
[ API Gateway ]
|
+--------+--------+--------+--------+
| | | | |
User Catalog Order Payment Shipping
|
OrderConfirmed event
|
[ Broker ] ---> Notification, Shipping
5.1 The “Place Order” journey
- Request: the front end sends the order to the API gateway, the single entry point.
- Order creation: the gateway routes the request to the order service, which acts as a coordinator rather than doing all the work itself.
- Stock check and payment: the order service makes synchronous calls to the catalog service, to make sure the items are in stock, and to the payment service, to take the payment.
- Notification and shipping: once payment is confirmed, the order service marks the order as confirmed and publishes an
OrderConfirmedevent asynchronously. The notification service sends a confirmation email, and the shipping service prepares the shipment and sends the tracking number back.
5.2 Benefits realized in this example
| Benefit | In practice |
|---|---|
| Scalability | During a holiday sale, the catalog and payment services scale up, while shipping stays the same |
| Fault tolerance | If the notification service is down, orders are still placed; the events wait in the queue until it recovers |
| Team autonomy | The payment team adds a new payment provider without touching or redeploying order or shipping |
| Technology diversity | The catalog uses a document database for flexible product attributes; orders use a relational database for transactional safety |
6. Use Case in Practice: Scaling One Service Independently
With Kubernetes, each service can scale automatically based on its own load. This HorizontalPodAutoscaler adds payment-service instances when their average CPU use goes above 70%, without touching any other service:
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: payment-service
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: payment-service
minReplicas: 2 # always at least 2 for availability
maxReplicas: 20 # upper limit during big sales
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
During a sale, the payment service might grow to 15 instances while the user service stays at 2. In a monolith, you would have to run 15 copies of everything.
7. Use Case in Practice: Event-Driven Features
New features can often be added by listening to existing events, without changing the services that publish them. For example, a new loyalty-points feature reacts to OrderConfirmed events:
package com.example.loyalty;
import java.math.BigDecimal;
import java.math.RoundingMode;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;
import com.example.events.OrderConfirmed;
@Component
public class LoyaltyPointsListener {
private final LoyaltyAccountService accounts;
public LoyaltyPointsListener(LoyaltyAccountService accounts) {
this.accounts = accounts;
}
@KafkaListener(topics = "order-confirmed", groupId = "loyalty-service")
public void onOrderConfirmed(OrderConfirmed event) {
// 1 point for every 10 currency units spent
int points = event.total()
.divide(BigDecimal.TEN, 0, RoundingMode.DOWN)
.intValue();
accounts.addPoints(event.customerId(), event.orderId(), points);
}
}
The order service does not change at all; it does not even know the loyalty service exists. This is one of the biggest practical benefits of microservices: adding features without touching existing code. Learn more in Event-Driven Architecture.
8. Use Case in Practice: The Right Database for Each Service
Because each service owns its data, it can use the database that fits its needs. The order service uses a relational database for transactions:
@Entity
@Table(name = "orders")
public class Order {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false)
private String customerId;
@Column(nullable = false, precision = 12, scale = 2)
private BigDecimal total;
@Enumerated(EnumType.STRING)
private OrderStatus status;
// constructors, getters and business methods
}
The catalog service stores products whose attributes vary a lot, such as size for shoes and screen size for laptops, so a document database such as MongoDB fits better:
@Document(collection = "products")
public record Product(
@Id String id,
String name,
String category,
BigDecimal price,
Map<String, String> attributes) { // flexible: {"size": "42"} or {"screen": "15.6 inch"}
}
public interface ProductRepository extends MongoRepository<Product, String> {
List<Product> findByCategory(String category);
}
Neither service can read the other’s database; they share data only through APIs and events. See the Database per Service pattern.
9. Use Case in Practice: Modernizing a Legacy Monolith
One of the most common real-world use cases is gradually modernizing an old monolith instead of rewriting it all at once. The Strangler Fig approach places a gateway in front of the monolith and moves one feature at a time into a new service:
spring:
cloud:
gateway:
server:
webflux:
routes:
# New: payments are now handled by the new microservice
- id: payment-service
uri: lb://payment-service
order: 0
predicates:
- Path=/api/payments/**
# Everything else still goes to the old monolith
- id: legacy-monolith
uri: http://legacy-shop:8080
order: 100
predicates:
- Path=/**
- Put the gateway in front of the monolith; all traffic still goes to the monolith.
- Build a new service for one well-bounded feature, such as payments, with its own database.
- Route that feature’s URLs to the new service.
- Remove the old code from the monolith, and repeat with the next feature.
Users never notice the change, and the risk of each step is small. See API Gateway and Monolithic vs Microservices Architecture.
10. More Strong Use Cases
| Use case | Why microservices help |
|---|---|
| Multi-tenant SaaS | Heavy customers can be given dedicated instances of busy services; features ship independently |
| Public APIs and partner integrations | Each integration is isolated, so a misbehaving partner cannot affect the core system |
| Real-time data and IoT | Data ingestion scales separately from processing, storage and dashboards |
| Machine learning features | Model-serving services, often in Python, run next to Java business services and can be updated on their own schedule |
| Global applications | Services can be deployed in different regions according to where their users are |
| Mobile back ends | A backend for frontend per app keeps responses small and fast while sharing core services |
11. When Not to Use Microservices
Microservices add network calls, distributed data, more deployments and more monitoring. They are often the wrong choice when:
| Situation | Better choice |
|---|---|
| A small team (for example fewer than 5–10 developers) | A well-structured monolith |
| A new product still searching for its purpose | A modular monolith that is easy to change |
| A simple application with mostly create, read, update and delete screens | A monolith |
| Strong, immediate consistency is needed across most of the data | One service with one database |
| No experience with containers, automation and monitoring | A monolith, while building those skills |
| Tight budget for infrastructure and operations | A monolith, or a few coarse-grained services |
A modular monolith, one deployable application with clearly separated modules, keeps most of the design benefits and makes a later move to microservices much easier.
12. A Simple Decision Checklist
Answer these questions honestly. The more “yes” answers, the stronger the case for microservices:
- Do several teams need to release features independently?
- Do parts of the system have very different load or scaling needs?
- Is the business domain well understood, with clear boundaries?
- Can a failure in one feature be tolerated while the rest keeps working?
- Do you have, or can you build, automated deployment, monitoring and tracing?
- Is the system expected to grow and change for many years?
If most answers are “no”, start with a monolith, keep it modular, and revisit the decision as the product and team grow.
13. Challenges to Plan For
This power comes with real costs. Plan for them from the start:
| Challenge | How to address it |
|---|---|
| Network calls fail or are slow | Timeouts, retries and circuit breakers |
| Data consistency across services | Events and the Saga pattern |
| Finding services | Service discovery |
| One entry point for clients | An API gateway |
| Debugging across services | Central logging, metrics and distributed tracing |
| Many deployments | Containers, Kubernetes and automated CI/CD pipelines |
| Too much traffic from clients | Rate limiting |
14. Getting Started the Right Way
- Start from the business: identify business capabilities and bounded contexts first. See Domain-Driven Design.
- Start small: begin with a few coarse-grained services, or a modular monolith, not dozens of tiny services.
- Automate early: builds, tests, deployments and infrastructure.
- Give each service its own data from day one.
- Prefer events for follow-up work, and keep synchronous call chains short.
- Invest in observability before the system grows: logs, metrics and traces.
- Align teams with services, so each team owns its services end to end.
- Extract services only for a reason, such as independent scaling, release speed or team growth.
15. Summary
Microservices architecture is a powerful tool for building scalable, resilient and agile software. Its main use cases revolve around managing complexity, scaling parts of a system independently, isolating failures, using the right technology for each job, and letting many teams work in parallel. E-commerce, finance, streaming, mobility, SaaS and IoT platforms all benefit, as do organizations gradually modernizing legacy systems. But this power comes with real operational costs in networking, data consistency and monitoring, so microservices are often the wrong choice for small teams, simple applications or new products. Make the decision deliberately, start small, and let real needs drive each new service. Continue with Monolithic vs Microservices Architecture to compare both approaches in depth.
16. Frequently Asked Questions (FAQ)
Q1. What are the most common use cases for microservices?
The most common use cases are:
- Large, fast-changing applications built by several teams.
- Systems with uneven load, where some features need far more capacity than others.
- High-availability platforms, where one failing feature must not bring everything down.
- Modernizing legacy monoliths step by step.
- Platforms with many integrations, such as partners, payment providers and devices.
Q2. Which kinds of companies use microservices?
Microservices are common in companies with large digital products and many engineering teams: online retail, streaming and media, banking and payments, ride-hailing and delivery, travel booking and SaaS providers. Many large internet companies have publicly described moving from monoliths to microservices as they grew.
Size of the product and team matters more than industry: a small company in any industry is often better served by a monolith.
Q3. Are microservices a good choice for a startup?
Usually not at the start. A startup needs to change direction quickly, and a small team spends a lot of time running many services instead of building features.
A better path is a well-structured, modular monolith. When the product finds its market and the team grows, extract services where there is a clear benefit, such as a part that needs independent scaling.
Q4. Can a small team successfully use microservices?
It is possible, but the overhead is high. Each service needs its own build, deployment, monitoring and on-call attention. A team of three or four developers running fifteen services spends much of its time on operations.
If a small team does choose microservices, keep the number of services low, use a managed platform, and automate everything.
Q5. Why are microservices popular for e-commerce?
- Traffic spikes: sales and holidays multiply load on catalog, search and checkout, which can scale independently.
- Many teams: search, checkout, payments and logistics teams can release independently.
- Resilience: a broken recommendation feature should never stop customers from buying.
- Integrations: payment providers, carriers and marketplaces are isolated behind their own services.
Q6. Why do banks and fintech companies use microservices?
Financial systems benefit from strong isolation: payments, cards, accounts and fraud detection can each have their own security controls, data and audit trail. Teams can change one product, such as card services, without risking the core ledger.
At the same time, finance needs very careful handling of data consistency, so patterns such as sagas, idempotency keys and event sourcing are especially important there.
Q7. Are microservices suitable for real-time applications?
Yes, for many real-time systems, such as live tracking, chat, gaming back ends and IoT. Different parts, such as ingesting data, processing it and pushing updates to users, can scale separately and use technologies suited to each, such as streaming platforms and WebSockets.
For extremely latency-sensitive paths, keep the number of network hops small; every extra service call adds delay.
Q8. How do microservices handle sudden traffic spikes?
Each service can scale on its own. With autoscaling, for example a Kubernetes HorizontalPodAutoscaler, busy services get more instances automatically, while quiet services stay small.
Message queues also help: work that does not need an immediate answer, such as emails or reports, waits in a queue and is processed at a steady pace, so the spike does not overwhelm those services.
Q9. Do microservices reduce infrastructure costs?
Sometimes, but not automatically. Scaling only the busy services can save money compared with copying a whole large monolith. On the other hand, microservices add costs: more instances, gateways, brokers, monitoring tools and engineering time for operations.
For large systems with uneven load, the savings often outweigh the extra costs; for small systems, they usually do not.
Q10. Are microservices a good way to modernize a legacy system?
Often yes, if done gradually. The Strangler Fig approach puts a gateway in front of the old system and moves one feature at a time into new services. Each step is small and reversible, and users never notice the change.
Avoid a “big bang” rewrite of the whole system at once; it is risky, slow and often fails.
Q11. How long does it take to move from a monolith to microservices?
It depends on the size of the system, but for a large application it is usually measured in months to years, done step by step alongside normal feature work.
A good first milestone is extracting one well-bounded feature, such as notifications or payments, and getting it into production. That builds the deployment, monitoring and team practices needed for the rest.
Q12. Can a monolith and microservices run together?
Yes, and this is very common. Many systems keep a core monolith and add new features as separate services around it, connected through an API gateway, APIs and events.
This hybrid can be a permanent, sensible design, not just a temporary stage. Extract parts of the monolith only when there is a real benefit.
Q13. Is a modular monolith a good first step?
For most new products, yes. A modular monolith is one deployable application, but the code is divided into clear modules, such as orders, payments and shipping, that talk only through defined interfaces.
You get simple deployment and debugging today, and well-defined boundaries that can become microservices later. In Spring Boot, Spring Modulith helps enforce these boundaries.
Q14. How many services should an e-commerce platform start with?
Start with a handful of coarse-grained services around clear business areas, for example catalog, orders, payments and users, plus a gateway. Split further only when a part needs to scale, release or change independently.
Starting with dozens of tiny services usually creates a distributed monolith that is hard to change and expensive to run.
Q15. Do microservices help mobile applications?
Yes. Mobile apps benefit from a backend for frontend (BFF): a service designed for the app that gathers data from several microservices and returns small, screen-ready responses in one call.
This saves battery and mobile data, and lets the app team change its API without affecting the web or partner APIs.
Q16. How do microservices support machine learning features?
Machine learning models are often built in Python, while the rest of the system may be in Java. Running a model as its own model-serving service lets data scientists update models on their own schedule and scale them on suitable hardware, such as GPUs.
Business services call the model service through an API, or the model service reacts to events, for example to score each new order for fraud.
Q17. Do microservices help with regulations and compliance?
They can. Sensitive data, such as card numbers or health records, can be kept inside a small number of services with strict access controls, encryption and auditing. That reduces the part of the system that must meet the strictest rules.
The trade-off is that data spread across services must be tracked carefully, for example to delete a customer’s data everywhere on request.
Q18. How can I tell if microservices are working for my organization?
Track delivery and reliability metrics, such as:
- Deployment frequency: how often teams release.
- Lead time for changes: from code commit to production.
- Change failure rate: how often a release causes problems.
- Time to restore service after an incident.
If these improve as teams gain independence, the architecture is helping. If they get worse, services may be too small or too tightly coupled.
Q19. What are the biggest risks when adopting microservices?
- Splitting too early or too finely, creating a distributed monolith where services must change and deploy together.
- Underestimating operations: monitoring, tracing, deployments and on-call work for many services.
- Data consistency problems when business processes span several services.
- Network failures without timeouts, retries and circuit breakers.
- Unclear ownership, where nobody is responsible for a service.
Most of these are avoided by starting small, defining boundaries around business capabilities and investing early in automation and observability.
Q20. Can serverless functions replace microservices for some use cases?
Yes, for some. Serverless functions, such as AWS Lambda, suit event-driven, spiky or occasional work: resizing uploaded images, processing webhooks or nightly jobs. You pay only when they run and manage no servers.
Long-running, steady, high-traffic services are often cheaper and simpler as containerized microservices. Many systems mix both.