In a microservices architecture, why is it beneficial for each service to have its own database?
Think about how independent services should be in microservices.
Each microservice having its own database allows it to evolve independently, avoiding tight coupling and enabling independent scaling and deployment.
Which diagram best represents the database per service pattern in microservices?
Remember the pattern means each service owns its data store.
In the database per service pattern, each microservice manages its own database, ensuring loose coupling and autonomy.
What is a common scaling challenge when using the database per service pattern?
Think about data that spans multiple services.
Because each service has its own database, keeping data consistent across services requires careful design, often using eventual consistency or event-driven approaches.
Which of the following is a tradeoff when adopting the database per service pattern?
Consider what happens when services need data from each other.
While each service controls its own data, querying across services becomes complex and may require additional mechanisms like APIs or event messaging.
You have 10 microservices, each following the database per service pattern. Each service requires 2 database instances for high availability. How many total database instances are needed?
Multiply the number of services by the number of instances per service.
Each of the 10 services needs 2 instances, so total instances = 10 * 2 = 20.