0
0
Microservicessystem_design~20 mins

Request aggregation in Microservices - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Request Aggregation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Architecture
intermediate
2:00remaining
Designing a request aggregator for microservices

You need to design a request aggregator that collects data from three microservices: User Service, Order Service, and Inventory Service. Which architectural pattern best suits this scenario to minimize client complexity and improve performance?

AClient-side aggregation where the client calls each service separately and combines results.
BAPI Gateway pattern that aggregates responses from all three services before returning to the client.
CDirect service-to-service calls where User Service calls Order Service and Inventory Service internally.
DUse a message queue to asynchronously collect data from services and send to client.
Attempts:
2 left
💡 Hint

Think about reducing the number of calls the client makes and centralizing aggregation.

scaling
intermediate
2:00remaining
Scaling a request aggregator under high load

Your request aggregator receives thousands of requests per second, each requiring data from multiple microservices. What is the best approach to scale the aggregator to handle this load efficiently?

ACache all microservice responses indefinitely to avoid calling them.
BIncrease the CPU and memory of a single aggregator instance to handle all requests.
CMake the aggregator synchronous and block requests until all microservices respond.
DDeploy multiple instances of the aggregator behind a load balancer and use asynchronous calls to microservices.
Attempts:
2 left
💡 Hint

Consider horizontal scaling and non-blocking calls.

tradeoff
advanced
2:00remaining
Tradeoffs in synchronous vs asynchronous request aggregation

When aggregating requests from multiple microservices, what is a key tradeoff between synchronous and asynchronous aggregation approaches?

AAsynchronous aggregation guarantees data freshness while synchronous aggregation always returns cached data.
BSynchronous aggregation always scales better than asynchronous aggregation.
CSynchronous aggregation offers simpler error handling but higher latency; asynchronous aggregation reduces latency but complicates error handling.
DSynchronous aggregation requires message queues, asynchronous does not.
Attempts:
2 left
💡 Hint

Think about latency and complexity in error handling.

🧠 Conceptual
advanced
2:00remaining
Understanding request fan-out and fan-in in aggregation

In request aggregation, what do the terms 'fan-out' and 'fan-in' refer to?

A'Fan-out' is sending requests to multiple services; 'Fan-in' is collecting and combining their responses.
B'Fan-out' means scaling horizontally; 'Fan-in' means scaling vertically.
C'Fan-out' is combining responses; 'Fan-in' is sending requests to services.
D'Fan-out' is caching data; 'Fan-in' is invalidating cache.
Attempts:
2 left
💡 Hint

Think about the direction of requests and responses.

estimation
expert
2:00remaining
Estimating capacity for a request aggregator

Your request aggregator handles 10,000 requests per second. Each request fans out to 4 microservices. Each microservice call takes 50ms on average. Assuming the aggregator calls services in parallel and has negligible processing overhead, what is the minimum number of aggregator instances needed to handle the load with a 1-second response time SLA?

AAt least 25 instances, because each instance can handle 400 requests per second.
BAt least 200 instances, because each instance can handle 50 requests per second.
CAt least 10 instances, because parallel calls reduce total time to 50ms per request.
DAt least 400 instances, because each microservice call adds 50ms sequentially.
Attempts:
2 left
💡 Hint

Calculate requests per instance based on response time and concurrency.