CSE Roadmap

Core tier · about 3 hours · 9 parts

Part 9 of 9 · 3 min read

Exercises

Easy

Easy 1: Size a pool (20 minutes)

A service must handle 7,200 requests per second. Each server handles 1,500. How many servers are needed, with N + 1?

Done when: a count of servers for the load, a count with one spare, and the capacity left after one failure.

Hint

Divide, then round up. Then add one.

Easy 2: Layer 4 or layer 7 (20 minutes)

Pick the layer for each need: route /video to a different pool, spread raw TCP connections, end TLS, absorb a flood of new connections, keep users on one server by cookie.

Done when: five answers, each with one reason.

Hint

Anything that needs the content of the request needs layer 7.

Easy 3: Read the table (20 minutes)

Using the rule table on page 4, pick a routing rule for: servers of different sizes, requests of very uneven cost, a cache that must keep keys on the same server, and a pool that is checked only every 10 seconds.

Done when: four rules chosen, each with the weakness to watch.

Hint

Match each need to the weakness in the table.

Medium

Medium 1: Move the keys (30 minutes)

A pool has 5 servers and keys are placed by hash modulo 5. A sixth server joins. Count how many of keys 0 to 29 stay in place. Give the share that moves, and compare it to the ideal share of 1 in 6.

Done when: a list of the staying keys, a share in percent, and one line on why the ideal is better.

Hint

A key stays only when the two remainders match.

Medium 2: Count the lost requests (30 minutes)

Four servers receive 1,200 requests per second in round robin. One dies. Checks run every 2 seconds and 3 misses are needed. Work out the failed requests. Then add a rule that a failed request is retried once on another server and say how the number changes.

Done when: a loss figure before the retry rule, a loss figure after it, and the extra load on the other three servers.

Hint

Loss = requests per second on the dead server × time to detect.

Medium 3: Place the regions (30 minutes)

Users are 60 percent in region X (round trip to the one central server 25 ms), 25 percent in Y (150 ms) and 15 percent in Z (260 ms). A page needs DNS 40 ms and 3 round trips. Compute the average time before the first byte now, and after regional servers at 20 ms in Y and Z only.

Done when: two weighted averages with the working shown.

Hint

Multiply each region's share by its time, then add.

Hard

Hard 1: Draw the front end (45 minutes)

Draw the path of a request for a shop used worldwide, from the user to a web server. Include geo DNS, a layer 4 balancer, a layer 7 balancer and the servers. For each box, write what it fails like and how it is protected.

Done when: one drawing, and a table with one row per box with failure and protection.

Hint

Draw from the outside in. Ask "what if this box dies?" for each.

Hard 2: Size the balancers (45 minutes)

Peak traffic is 90,000 requests per second. A layer 7 balancer handles 30,000. Find the smallest number that survives the loss of one, and the smallest that survives the loss of two. Add 20 percent growth in a year and redo both.

Done when: four counts, with each division shown.

Hint

Total load ÷ capacity, rounded up, plus the number allowed to fail.

Hard 3: A health endpoint that lies (50 minutes)

A health endpoint returns 200 whenever the process runs. One night the database becomes unreachable. Describe what users see. Then design a better endpoint and show how it could also cause a full outage if it checks the database too strictly. Propose a middle path.

Done when: a timeline of what users see, a better endpoint design, one way it can backfire and a middle path.

Hint

Compare "process is up" with "process can do its job" and with "every server fails at once".