Skip to main content
Glossary

Microservices

An architectural style where an application is built as a collection of small, independent services that communicate over well-defined APIs.

Detailed Explanation

Microservices decompose a large application into smaller, focused services, each responsible for a specific business capability. Unlike a monolith where all code runs in one process, microservices run independently, can be developed in different languages, and can be deployed separately.

Each microservice owns its data and business logic. Services communicate through APIs (synchronous) or message queues (asynchronous). This architecture enables teams to work independently, scale specific services, and use different technologies per service. However, it introduces complexity in service discovery, distributed transactions, monitoring, and debugging.

Why It Matters

Microservices enable large teams to work independently and scale specific parts of the system. However, they add significant complexity and are not always the right choice.

Real-World Example

Netflix runs hundreds of microservices: one for user profiles, one for recommendations, one for video streaming, one for billing. Each can be scaled, updated, and deployed independently.

When to Use

When you have large teams that need to work independently, different parts of the system have different scaling requirements, or you need technology diversity. Avoid for small teams or simple applications.

Advantages

  • Independent deployment and scaling
  • Technology diversity per service
  • Teams can work independently
  • Fault isolation (one service failure doesn't crash everything)
  • Easier to understand individual services

Disadvantages

  • Significant operational complexity
  • Distributed system challenges (latency, consistency)
  • Service discovery and load balancing overhead
  • End-to-end testing is harder
  • Requires mature DevOps practices

Frequently Asked Questions

When should I use microservices over a monolith?

Start with a monolith and extract microservices when you have clear reasons: large teams needing independence, different scaling requirements, or technology diversity needs. Most startups should begin as a monolith.

How do microservices communicate?

Synchronous: HTTP/REST or gRPC for direct calls. Asynchronous: message queues (RabbitMQ, SQS) or event streams (Kafka) for event-driven communication. Choose based on coupling and latency requirements.

What is a service mesh?

A service mesh (Istio, Linkerd) handles service-to-service communication, providing load balancing, encryption, observability, and circuit breaking. It adds infrastructure complexity but solves common microservice challenges.

How do I handle data across microservices?

Each service owns its data. Avoid shared databases. Use events for cross-service data consistency (eventual consistency). Use the Saga pattern for distributed transactions that span multiple services.

What is the difference between microservices and SOA?

SOA (Service-Oriented Architecture) uses a shared enterprise service bus (ESB) and shared data models. Microservices are more granular, use simple protocols (HTTP), and each service owns its data. Microservices are a modern evolution of SOA.

Back to Glossary

Browse all terms in our software development glossary.

Browse All Terms