# Self-Contained Service

> Design services to respond without blocking on calls to other services.

- **Category**: Microservices
- **Subcategory**: Resilience
- **Canonical URL**: https://designpattern.fyi/patterns/self_contained_service/

---

## Description
Clean, reusable architecture pattern.


## Use Cases
Order Service needs menu data to validate an order. Instead of calling Restaurant Service on every POST /orders, it keeps a local MenuReplica (updated via events). createOrder() responds in <100ms, fully self-contained.





## Trade-offs


### Advantages

- Low latency — no synchronous cross-service calls on the hot path

- High availability — not dependent on other services being up at request time

- Resilient to downstream failures

- Simpler request flow — no distributed call chain to trace




### Considerations & Drawbacks

- Local data is eventually consistent — commands may act on slightly stale data

- Requires event subscription infrastructure to keep replicas fresh

- More storage per service (local replicas)

- Complex to keep replicas in sync across multiple data sources







---
**Reference**: [Original Source](https://microservices.io/patterns/decomposition/self-contained-service.html)

