0
0
Microservicessystem_design~20 mins

Routing and load balancing in Microservices - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Routing and Load Balancing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
How does round-robin load balancing distribute requests?
Imagine you have 3 identical servers behind a load balancer using round-robin. How will the load balancer distribute 6 incoming requests?
ARequests are sent to the server with the least CPU usage.
BAll 6 requests go to Server1 until it is full, then move to Server2.
CRequests are sent randomly to any server without order.
DEach server receives 2 requests in order: Server1, Server2, Server3, then repeat.
Attempts:
2 left
💡 Hint
Think about how round-robin cycles through servers evenly.
Architecture
intermediate
2:00remaining
Choosing a load balancer for microservices
You have a microservices system with many small services. Which load balancing approach fits best to route requests efficiently?
AUse DNS round-robin to distribute requests among service IPs.
BUse client-side load balancing where each service instance chooses the next service instance to call.
CUse a centralized hardware load balancer that routes all requests externally.
DUse a single service instance to route all requests to others.
Attempts:
2 left
💡 Hint
Think about scalability and dynamic service discovery in microservices.
scaling
advanced
2:00remaining
Scaling load balancers for high traffic
Your system faces millions of requests per minute. What is the best way to scale load balancing to avoid bottlenecks?
AUse a single powerful load balancer with very high CPU and memory.
BUse only client-side load balancing without any central load balancer.
CDeploy multiple load balancers in parallel with DNS-based load balancing among them.
DRoute all traffic through a database to decide which server to use.
Attempts:
2 left
💡 Hint
Think about avoiding single points of failure and distributing load evenly.
tradeoff
advanced
2:00remaining
Tradeoffs between sticky sessions and stateless load balancing
What is a key tradeoff when using sticky sessions (session affinity) in load balancing compared to stateless balancing?
ASticky sessions simplify user session handling but reduce load distribution flexibility.
BStateless balancing causes user sessions to be stored on the load balancer.
CStateless balancing requires all requests to go to the same server.
DSticky sessions improve fault tolerance but reduce cache efficiency.
Attempts:
2 left
💡 Hint
Consider how session data affects routing choices.
estimation
expert
3:00remaining
Estimating load balancer capacity for peak traffic
Your service expects 10 million requests per hour at peak. Each request requires 5ms processing on the load balancer. How many load balancer instances are needed to handle peak load without queuing?
AAt least 14 load balancer instances
BAt least 28 load balancer instances
CAt least 7 load balancer instances
DAt least 35 load balancer instances
Attempts:
2 left
💡 Hint
Calculate requests per second and how many can be handled per instance.