# Microservices and Service-Oriented Architecture

> Split a system into independently deployable services and understand the real costs that come with it. Free notes, key concepts, resources and a mini project.

Canonical: https://www.internhack.in/roadmaps/tracks/backend/microservices-soa
Last updated: 2026-11-28

Split a system into independently deployable services and understand the real costs that come with it.

Advanced · about 6 hours · difficulty 4/5

Learn first: [Monoliths and Modular Monoliths](https://www.internhack.in/roadmaps/tracks/backend/monolith-modular), [gRPC and Protocol Buffers](https://www.internhack.in/roadmaps/tracks/backend/grpc)

**Microservices** decompose a system into small services, each owning one business capability and its own data, deployed independently and talking over the network. **SOA** (service-oriented architecture) is the older, enterprise-flavored ancestor, often built around a shared enterprise service bus and heavier contracts.

### What you gain

- Teams deploy on their own schedule without coordinating a release train.
- Services scale independently (the image resizer can have 50 instances, the admin API 2).
- Failures and technology choices can be isolated.

### What you pay

- **Network calls fail**: timeouts, retries and partial failure are now normal (see resilience patterns).
- **Data is distributed**: no joins across services and no simple transactions. You use events, sagas and eventual consistency.
- **Operational overhead**: many pipelines, dashboards, versions and on-call surfaces. Observability becomes mandatory.
- **Contract management**: breaking an API now breaks another team.

### Design guidelines

- Split by **business capability or bounded context**, not by technical layer ("the database service" is an anti-pattern).
- **Database per service**: other services go through the API, never directly to your tables.
- Prefer **asynchronous events** for notifications between services and synchronous calls (REST, gRPC) only when an answer is needed now.
- An **API gateway** handles cross-cutting concerns (auth, rate limiting, routing) at the edge.

### The distributed monolith

Services that must be deployed together, share a database, or call each other in long synchronous chains have all the costs of microservices and none of the benefits.

You are ready to move on when you can take a monolith's modules, argue which (if any) should become services, and describe how they would communicate and own data.

## Key concepts

- **Service boundaries by capability**
- **Database per service**
- **Sync vs async communication**
- **API gateway**
- **Service discovery**
- **Sagas for distributed workflows**
- **SOA and enterprise service bus**
- **Distributed monolith anti-pattern**

## Mini project

Extract one module (for example notifications) from your monolith into a separate service with its own database, communicating through an event queue, and document the failure modes you had to handle.

## Check yourself

Two services share one database schema. Why does that undermine the main benefit of microservices?

## Free resources

- [Microservices](https://martinfowler.com/articles/microservices.html) (Martin Fowler)
- [Microservice Architecture patterns](https://microservices.io/) (Chris Richardson)
- [Microservices architecture style](https://learn.microsoft.com/en-us/azure/architecture/guide/architecture-styles/microservices) (Microsoft Learn)

Previous: [Monoliths and Modular Monoliths](https://www.internhack.in/roadmaps/tracks/backend/monolith-modular) · Next: [Serverless and Functions as a Service](https://www.internhack.in/roadmaps/tracks/backend/serverless)

## More in Architecture and Design Patterns

- [Monoliths and Modular Monoliths](https://www.internhack.in/roadmaps/tracks/backend/monolith-modular)
- [Microservices and Service-Oriented Architecture](https://www.internhack.in/roadmaps/tracks/backend/microservices-soa)
- [Serverless and Functions as a Service](https://www.internhack.in/roadmaps/tracks/backend/serverless)
- [Twelve-Factor Apps and Cloud-Native Habits](https://www.internhack.in/roadmaps/tracks/backend/twelve-factor-apps)
- [Service Mesh](https://www.internhack.in/roadmaps/tracks/backend/service-mesh)
- [Design Patterns for Backend Code](https://www.internhack.in/roadmaps/tracks/backend/design-patterns-gof)
- [Domain-Driven Design](https://www.internhack.in/roadmaps/tracks/backend/domain-driven-design)
- [CQRS and Event Sourcing](https://www.internhack.in/roadmaps/tracks/backend/cqrs-event-sourcing)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Backend Developer Roadmap](https://www.internhack.in/roadmaps/tracks/backend)
