Question #49 of 60•Microservices•Medium• ~3 min read

Why is Shared Database between microservices an anti-pattern (Database-per-Service)?

Executive Takeaway

Examine tight schema coupling, database connection pool exhaustion, and loss of service boundary isolation.

Architectural Breakdown & AnalysisFAANG Aligned

Allowing multiple microservices to read and write directly to a shared relational database breaks microservice autonomy.

Drawbacks of Shared Databases

  1. Tight Schema Coupling: Modifying a table column in Service A breaks queries in Service B, forcing coordinated deployments.
  2. Resource Lock Contention: High write queries in Order Service consume CPU and lock tables needed by User Service.
  3. Loss of Polyglot Persistence: Forces all services to use the same database engine regardless of data access model suitability.

Database-Per-Service Pattern

Each microservice owns its private database. Other services access data exclusively via published REST/gRPC APIs or asynchronous domain events.

TIP — Legacy Migration Rule

When decomposing monolithic databases, use Change Data Capture (Debezium) to stream updates asynchronously while transitioning to private service DBs.

Key Architectural Comparison

Database ArchitectureMicroservice AutonomySchema Migration RiskCross-Service QueriesBlast Radius
Shared Database (Anti-pattern)Low (All services locked to single DB).High (Altering table breaks multiple teams).Trivial SQL JOIN.Critical (Single DB crash takes down entire company).
Database-per-Service100% Autonomous.Zero blast radius across services.Requires API calls or asynchronous CQRS events.Isolated (Service A outage does not affect Service B).
Previous QuestionHow do you design a Nearby Places Geospatial Service (Uber / Yelp)?Next Question How do Operational Transformation (OT) and CRDTs power Real-Time Collaborative Editors?

Continue Learning on Being SDE

Explore deep-dive system architecture modules, low-level object-oriented designs, and interview cheat sheets.