Database per Service Pattern — Concept Check
Questions on Database per Service Pattern. Each microservice owns its data store (SQL, NoSQL, graph) chosen for its workload; inter-service data access happens only through APIs, never direct DB queries.
Questions in this quiz
8 questions on Database per Service Pattern — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A microservice team decides to directly query another service's database to improve response times. What potential issue does this introduce?
- AIt leads to tight coupling between services.
- BIt simplifies schema evolution.
- CIt ensures better data consistency.
- DIt improves scalability of both services.
2.A developer is implementing a feature where Service A needs to access data from Service B. Which approach aligns with the Database per Service pattern?
- AService A uses a shared database with Service B.
- BService A accesses Service B's database through a VPN.
- CService A calls Service B's API to get the data.
- DService A directly queries Service B's database.
3.An engineer suggests using foreign key constraints across microservices to maintain referential integrity. Why is this not recommended?
- AIt violates the principle of service autonomy.
- BIt simplifies data access.
- CIt enhances eventual consistency.
- DIt leads to performance issues.
4.During a high-traffic event, Service A's dependent API calls to Service B are causing bottlenecks. What is a recommended solution?
- AIncrease the timeout for API calls.
- BDirectly query Service B's database.
- CImplement a local materialised view in Service A.
- DUse a shared database for both services.
5.A team is using the Outbox pattern to ensure atomic event publishing with database writes. What problem does this solve?
- ASchema evolution across services.
- BData consistency across distributed systems.
- CDirect database access between services.
- DPerformance bottlenecks in API calls.
6.A developer claims that using a shared database for multiple services simplifies data management. What is a common oversight in this belief?
- AIt enhances data consistency.
- BIt improves scalability.
- CIt simplifies schema evolution.
- DIt reduces service autonomy and increases coupling.
7.What challenge arises when performing distributed joins in microservices?
- AThey simplify data consistency.
- BThey can lead to N+1 query problems.
- CThey eliminate the need for APIs.
- DThey require direct database access.
8.Which pattern helps maintain eventual consistency in distributed systems?
- AForeign key constraints.
- BShared database pattern.
- CDirect database queries.
- DSaga and Outbox patterns.