Global and Local Load Balancing 00:00:01 Tokyo chooses a worker after the region is chosen A traveler in Japan opens an API. Follow the two decisions separately. The first selects a regional entrance, and the second sees which Tokyo worker has the fewest open requests. The user opens api.example.com. The question comes from Japan, so the answer is the Asia-Pacific region in Tokyo. The request goes straight to the Tokyo balancer. DNS is out of the path. Servers have 9, 3 and 6 open requests. Server 2 is chosen. The reply comes from nearby. The next request goes to server 3. GeoDNS notices nothing, and need not. DNS can leave the forwarding path after it supplies an address. The regional balancer can change backends on later requests without issuing a new regional DNS answer. 00:00:56 Distance, latency, weights or an ordered standby Send the same traveler through four regional policies. Predict which policy can deliberately choose a distant region even when a closer region is ready. The user is in Europe, so the European region answers. The lowest measured delay wins. Usually it is the near one. Shares of 70, 20 and 10. Most rolls send the user to America. America is the primary and it is healthy. Every healthy address, up to eight. The client tries them. A geographic label, measured latency, traffic weight and failover preference answer different questions. Check the policy against residency rules, real capacity and the measurements available to it. 00:01:44 The region fails while its address is cached A regional DNS answer lives for sixty seconds. Health checks run independently of each user's cache. Track the last old answer issued before the region is removed. DNS answers with region A, for 60 seconds at a time. Probes fail once and twice. DNS still answers A. The third failure. New lookups get region B. Once the last still-valid sixty-second entry expires, a cache that resolves again under these assumptions learns the replacement address. A few programs looked the name up once and never again. They need a restart. Recovery includes detection time, cached-answer lifetime and client behavior. A client that keeps a resolved address or an existing connection indefinitely needs its own recovery mechanism. 00:02:37 Withdraw one route to the same address Paris reaches a European site through an anycast address also announced in America. Withdraw the European route and follow how newly routed connections move. Both sites announce 203.0.113.1. Routes from Paris lead to Europe. The European site finds itself unhealthy. Networks learn that the only path left leads to America. New connections work, from farther away. Open ones had to reconnect. Routing convergence and application connection state have separate lifetimes. The same public address can deliver a new connection to a different site while an old session needs recovery. 00:03:22 The healthy region inherits too much traffic Two equal regions each run at seventy percent. Lose one and predict the demand on the survivor before enabling failover. Then repeat at forty percent starting utilization. Two regions run at 70%. Region B would need one hundred forty percent of its capacity. It slows down under the extra traffic. Region B also fails its health checks. Run each at 40%. After a failure B is at 80%. A returns with 10%, then 25%, then half, while its caches warm up. At seventy plus seventy the survivor would need one hundred forty percent of its capacity. Reserve headroom, shed optional work and return traffic gradually while a recovering region warms.