0
0
Microservicessystem_design~20 mins

Aggregates and entities in Microservices - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Aggregate Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Aggregate Boundaries

In a microservices system, which statement best describes the role of an aggregate?

AAn aggregate is a cluster of domain objects that can be treated as a single unit for data changes and consistency.
BAn aggregate is a single database table that stores all entities in the system.
CAn aggregate is a microservice responsible for handling all user requests directly.
DAn aggregate is a UI component that displays multiple entities on the screen.
Attempts:
2 left
💡 Hint

Think about how data consistency is maintained within a group of related objects.

Architecture
intermediate
2:00remaining
Entity Identity in Aggregates

Which option correctly explains how entities within an aggregate are identified?

AEntities inside an aggregate share the same global identifier as the aggregate root.
BEntities inside an aggregate are identified by the microservice name and the aggregate root's ID combined.
CEntities inside an aggregate do not have identifiers and are identified only by their attributes.
DEach entity inside an aggregate has its own unique identifier, but only the aggregate root's ID is exposed externally.
Attempts:
2 left
💡 Hint

Consider which entity is responsible for external references.

scaling
advanced
2:30remaining
Scaling Aggregates in Microservices

You have a microservice managing orders as aggregates. Each order aggregate contains multiple line item entities. What is the best approach to scale this microservice when order volume grows rapidly?

AStore line items in a separate database and query them on demand without transactional consistency.
BSplit the order aggregate into separate microservices for order header and line items to scale independently.
CKeep the order aggregate as one unit and scale the microservice horizontally by adding more instances.
DCache all order aggregates in memory to avoid database calls and improve performance.
Attempts:
2 left
💡 Hint

Think about aggregate boundaries and transactional consistency.

tradeoff
advanced
2:30remaining
Tradeoffs in Aggregate Size

What is a key tradeoff when designing very large aggregates containing many entities?

ALarge aggregates reduce complexity by grouping all entities but make it impossible to maintain consistency.
BLarge aggregates improve performance by reducing the number of database calls but increase the risk of contention and slower updates.
CLarge aggregates always improve scalability because they reduce the number of microservices needed.
DLarge aggregates eliminate the need for aggregate roots and simplify entity management.
Attempts:
2 left
💡 Hint

Consider how aggregate size affects database transactions and concurrency.

estimation
expert
3:00remaining
Estimating Aggregate Load Capacity

A microservice manages a 'Customer' aggregate with 5 entities inside. Each aggregate update takes 100ms on average. The system must handle 1000 updates per second. What is the minimum number of microservice instances needed to meet this load without queuing?

AAt least 100 instances, because each instance can handle 10 updates per second (1000ms / 100ms).
BAt least 10 instances, because 1000 updates * 100ms = 100 seconds total processing time per second.
CAt least 5 instances, because there are 5 entities per aggregate and each takes 100ms.
DAt least 20 instances, because 1000 updates / 50 updates per instance per second = 20.
Attempts:
2 left
💡 Hint

Calculate how many updates one instance can handle per second, then divide total load by that.