SA-301b · Module 2

Database Per Service

4 min read

Database-per-service is the data ownership pattern that makes microservices real. Each service owns its data store — schema, access, migration, backup. No other service reads from or writes to it directly. All data access crosses the service boundary through APIs or events. This is the hardest discipline in microservices and the one most frequently violated, because sharing a database is easy and the cost is deferred.

The deferred cost is coupling. When two services share a database, a schema migration in one service can break the other. A heavy query from one service degrades performance for the other. A data model change requires coordinating two teams. The shared database negates every benefit that microservices provide — independent deployment, independent scaling, independent evolution. The services are microservices in name and a monolith in practice.