Part 9 of 9 · 3 min read
Exercises
Easy
Easy 1: Choose a method (20 minutes)
For each case pick static file, DNS or registry and give a reason: three fixed servers that never change, a service that autoscales from 4 to 40, a public website with two regions.
Done when: three choices, each with a reason and a weakness.
Hint
Ask how often the list of servers changes.
Easy 2: Heartbeat expiry (20 minutes)
Beats are sent every 3 seconds and an entry expires after 4 missed beats. How long can a dead address stay listed? How many beats per second reach the registry from 600 instances?
Done when: a time in seconds and a message rate.
Hint
Expiry = interval × missed beats. Rate = instances ÷ interval.
Easy 3: Gateway or balancer (20 minutes)
Decide whether each job belongs to a balancer or to a gateway: spreading requests over 6 copies of one service, mapping /v1/orders to the order service, merging three replies into one, removing a dead server from a pool.
Done when: four answers with one reason each.
Hint
A balancer works on copies of one service. A gateway works on different services.
Medium
Medium 1: Availability of a screen (30 minutes)
A screen needs 4 required services at 99.95 percent each and 2 optional services. Find the availability of the screen, and the downtime per 30-day month. Then compare with 4 required services at 99.9 percent.
Done when: two availability figures and two downtime figures in minutes.
Hint
Multiply the required availabilities only.
Medium 2: Parallel or in turn (30 minutes)
A gateway calls services that take 40, 70 and 90 ms. Find the total time in turn and in parallel. Then add a limit of 80 ms for each call: what does the result become if the third call times out?
Done when: three times and a description of what the client receives.
Hint
In turn is the sum. Parallel is the largest, and a timeout caps each call.
Medium 3: Write the routing map (30 minutes)
A shop has services for users, products, orders and payments. Write six public paths with the internal service each reaches. Then rename an internal path and show what changes.
Done when: a table of six rows and a note of exactly one changed cell.
Hint
Only the map's right-hand column changes when an internal path is renamed.
Hard
Hard 1: Design the login path (45 minutes)
Draw the steps from a client's login to an order request that passes through a gateway to two services. Choose opaque or transparent tokens. Say where authentication and authorization happen, and how a token is revoked.
Done when: a numbered flow, a token choice with a reason, and a revocation plan.
Hint
Authenticate once at the edge, authorize in each service.
Hard 2: Size and protect the gateway (45 minutes)
A gateway handles 36,000 public calls per second at peak, and a node handles 9,000. Find the number of nodes for N + 1, and for surviving two losses. Describe three ways the gateway could become a bottleneck for teams or for traffic, and a fix for each.
Done when: two node counts and three problems with a fix each.
Hint
Nodes = peak ÷ capacity, rounded up, plus the failures allowed.
Hard 3: Is it needed yet (50 minutes)
A start-up has a monolith and one mobile app. It plans five services in a year. Argue both for building a gateway now and for waiting. Pick a plan with a trigger that says when to build it.
Done when: two arguments, a plan, and a trigger based on a measurable number.
Hint
Pick a trigger such as the number of services, clients or repeated pieces of code.