0
0
Microservicessystem_design~20 mins

Database decomposition strategy in Microservices - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Database Decomposition Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding database decomposition in microservices

Which of the following best describes the main goal of database decomposition in a microservices architecture?

ATo replicate the entire database for each microservice to ensure data consistency.
BTo merge multiple small databases into one large database to simplify data management.
CTo split a large monolithic database into smaller, service-specific databases to reduce coupling and improve scalability.
DTo use a single shared database schema for all microservices to avoid data duplication.
Attempts:
2 left
💡 Hint

Think about how microservices aim to be independent and scalable.

Architecture
intermediate
2:00remaining
Choosing a decomposition strategy

You have a monolithic e-commerce database with tables for users, orders, products, and payments. Which decomposition strategy best fits splitting this database for microservices?

ADecompose by business capability: create separate databases for user management, order processing, product catalog, and payment services.
BDecompose by data type: separate databases for numeric data, text data, and date data.
CDecompose by database size: split the database into equal-sized chunks regardless of data type.
DDecompose by access frequency: put frequently accessed tables in one database and rarely accessed tables in another.
Attempts:
2 left
💡 Hint

Think about how microservices align with business functions.

scaling
advanced
2:00remaining
Scaling challenges with database decomposition

After decomposing a monolithic database into multiple microservice databases, which challenge is most likely to arise when services need to perform transactions involving multiple databases?

AAvoiding data duplication by sharing the same database schema.
BIncreasing the size of a single database to handle all transactions.
CReducing network latency by merging all databases back into one.
DEnsuring data consistency across distributed databases without using distributed transactions.
Attempts:
2 left
💡 Hint

Consider the difficulty of keeping data consistent when it is spread across services.

tradeoff
advanced
2:00remaining
Tradeoffs in database decomposition strategies

What is a common tradeoff when choosing to decompose databases by business capability in microservices?

AImproved service independence but increased complexity in data consistency and cross-service queries.
BFaster development cycles but higher risk of data loss.
CSimplified data management but reduced service scalability.
DLower operational costs but slower response times.
Attempts:
2 left
💡 Hint

Think about what happens when data is split but services still need to work together.

estimation
expert
2:00remaining
Estimating capacity for decomposed microservice databases

You have decomposed a monolithic database into three microservice databases: UserDB, OrderDB, and ProductDB. UserDB handles 1000 requests/sec, OrderDB 500 requests/sec, and ProductDB 2000 requests/sec. If each request reads 5 KB on average, what is the total read throughput in MB/sec across all databases?

AApproximately 8.5 MB/sec
BApproximately 17.5 MB/sec
CApproximately 12.5 MB/sec
DApproximately 25 MB/sec
Attempts:
2 left
💡 Hint

Calculate total requests per second multiplied by average data size, then convert KB to MB.