Key Algorithms in a Content Delivery System Akamai Technologies and Carnegie Mellon University Bruce Maggs
Akamai Services and Products windowsupdate.microsoft.com/
Embedded Image Delivery (e.g., Yahoo!) <html><head> Welcome to xyz.com! Welcome to xyz.com! </head><body> <img src=“ Welcome to our Web site! Welcome to our Web site! Click here to enter Click here to enter </body></html> Embedded URLs are Converted to ARLs ak
End User Akamai DNS Resolution Akamai High-Level DNS Servers 10 g.akamai.net 1 Browser’s Cache OS 2 Local Name Server 3 xyz.com’s nameserver 6 ak.xyz.com 7 a212.g.akamai.net Akamai Low-Level DNS Servers 12 a212.g.akamai.net xyz.com.com.net Root (InterNIC) akamai.net8 select cluster select servers within cluster
Three Algorithms Consistent hashingConsistent hashing Leader electionLeader election Stable marriage with tree constraintsStable marriage with tree constraints
Hashing E.g., h(x) = (((a x + b) mod P) mod |B|), where P is prime, P > |U| a,b chosen uniformly at random from Z P x is a serial number Universe U of all possible objects, set B of buckets. object: set of web objects with same serial number bucket: web server Hash function h: U B Assigns objects to buckets
f(d) = d + 1 mod 5 Difficulty changing number of buckets bucket object f(d) = d + 1 mod 4
Consistent Hashing Idea: Map both objects and buckets to unit circle. object bucket Assign object to next bucket on circle in clockwise order. new bucket
Complication – Different Views select servers within cluster Low-level DNS servers act independently and may have different ideas about how many and which servers are alive. a212.g.akamai.net Akamai Low-Level DNS Servers
Properties of Consistent Hashing Monotonicity: When a bucket is added/removed, the only objects affected are those that are/were mapped to the bucket. Balance: Objects are assigned to buckets “randomly”. -- can be improved by mapping each bucket to multiple places on unit circle Load: Objects are assigned to buckets evenly, even over a set of views. Spread: An object should be mapped to a small number of buckets over a set of views.
Actual low-level load-balancing alg. a212: a213: a214: a215: random permutations of servers Why? To spread load for one serial number.
Leader Election Example All low-level name servers for a cluster compute the hash table. One is elected leader and distributes its table to the others.All low-level name servers for a cluster compute the hash table. One is elected leader and distributes its table to the others.
And now, some slides from Michel Goemans (high-level load balancing)
Stable Marriages Assignment of men and womenAssignment of men and women -Each man ranks each woman and vice versa -Marriage stable if no pair (m,w) unmatched where m prefers w to his “wife” and w prefers m to her “husband”
Residents-Hospitals Extension Residents-HospitalsResidents-Hospitals -results + algorithm extends to case in which hospital j can accept c(j) residents -In use since 1951 by National Intern Matching Program
Multi-Dimensional Load Not a single constraining resource!Not a single constraining resource! Can be:Can be: -Bandwidth -CPU usage (e.g. key signing for https) -Disk usage (e.g. for cache misses, auction sites) -Memory (e.g. EdgeJava) -Threads (e.g. EdgeJava) -Number of licenses in Realaudio
Stable Allocations With Tree Constraints [G ’00]:[G ’00]: -resources 1,…,k -Supply item j has rooted tree T(j) of constraints V(T(j))={1,…,k} Every node v of T has capacity c(j,v) -Demand item i has basic resource b(i) and demand d(i) When x units mapped to supply j, uses x units of each resource on path in T(j) from b(i) to root of T(j) -Stability as before
Instance of Problem Demand items: (groups of IPs, rule for mapping)Demand items: (groups of IPs, rule for mapping) m=hundreds of thousands m=hundreds of thousands Supply items: cluster of serversSupply items: cluster of serversn=thousands (Incomplete) preference lists for demands based on performance + contract rules(Incomplete) preference lists for demands based on performance + contract rules (Implicit) preference lists for supplies based on alternate choices, contract rules, …(Implicit) preference lists for supplies based on alternate choices, contract rules, … Tree of constraints model various resource constraintsTree of constraints model various resource constraints
[9,9] [0,9] [7,9] [2,9][7,9] [9,9] 2 3 Algorithm for Tree Constraints Demand items request unassigned demands in order of preferenceDemand items request unassigned demands in order of preference When demand i requests x units from j, repeat:When demand i requests x units from j, repeat: -Find lowest (in tree) tight constraint, say node v -Dispose demands (up to x) of lower preference than i and using resources in subtree rooted at v Demand = [0,8] [0,9] [0,6] [0,12] [0,5] [0,7] [load,cap] [2,6] [2,9] [2,12] [3,5] [5,12] [5,7] [10,12] 2 [2,8] [4,9] [12,12] [0,6] [2,9] [10,12] 4 [4,9] [12,12] [4,8] 1 [1,7] [5,9] [8,12] 8 [8,8] [8,9] [12,12]
Rich areas for research Providing database scalabilityProviding database scalability -Efficiency -Consistency -Security Securing a system with physically insecure serversSecuring a system with physically insecure servers