The motivating problem
njobs must be assigned tomidentical machines; each job carries a job ID drawn from the universeU4:54,5:37.- If all jobs are known up front, split them evenly: first
n/mto machine 1, nextn/mto machine 2, etc.6:07. - Online arrivals break that. "Send to the least-loaded machine" works but needs a global view of every machine's load, which we want to avoid
6:26,6:47. - The stateless alternative: when job
jarrives, process it on machineh(j)— i.e. hash the job ID to a machine6:47. - This is exactly the balls and bins process:
nballs thrown randomly intombins. The question is whether any bin gets badly overloaded relative to then/maverage7:32,8:05.
The Chernoff bound (stated, not fully proved)
- Setup:
X1, …, Xnindependent, eachXi ∈ {0,1}withE[Xi] = pi; letX = Σ Xi8:42,9:33. - Bound:
Pr[X > (1+δ)·E[X]] ≤ ( e^δ / (1+δ)^(1+δ) )^E[X]10:00. - Proof sketch given in class
16:35,17:00:- Markov's inequality: for non-negative
Xand anyλ > 0,Pr[X > λ] ≤ E[X]/λ. - Exponentiate both sides:
Pr[X > λ] = Pr[e^{tX} > e^{tλ}]for anyt > 017:54,18:29. - Apply Markov:
≤ e^{-tλ}·E[e^{tX}], then bound the moment generating function and optimiset; the calculation ends up choosingt = ln(1+δ)18:29,18:47. - The full derivation is left to references (e.g. Wikipedia)
19:10.
- Markov's inequality: for non-negative
Result for the case m = n
- With
m = n, average load is exactly 1 per machine, and:Pr[∃ machine with more than c·log n / log log n jobs] ≤ 1/poly(n)10:36. - Chernoff derivation: fix machine
t, setXi = 1iffh(i) = t, soXcounts jobs on machinetandE[X] = 111:44,12:53. - With
δ ≈ log n / log log n, the bound collapses to(e/k)^kwithk ≈ log n / log log n13:10,13:59. - Why
k^k = poly(n)forcesk ≈ log n / log log n: take logs, givingk·ln k = c·ln n; a smaller constant makes it too small, a larger one too big14:27,15:04. - Union bound over the
nmachines multiplies the per-machine failure probability byn, leaving1/n^{c'-1}— still1/poly(n), so with high probability no machine exceeds that load15:19,16:05.
The simpler union-bound proof (Chernoff is overkill)
Chernoff was stated because it is a broadly useful tool, but this result needs far less 11:25, 19:10:
- All machines are symmetric, so
Pr[∃ overloaded]≤n · Pr[machine 1 overloaded]19:10,20:01. - "Overloaded" means at least
kitems land there; union-bound over allk-subsetsT20:29. - For a truly random
handm = n,Pr[all of T maps to bin 1] = 1/n^k21:21,21:50. - Summing over
C(n,k)subsets givesC(n,k)/n^k ≤ 1/k!22:14. - Crude but sufficient:
k! ≥ (k/2)^{k/2}— no Stirling needed22:54. - Solving
(k/2)^{k/2} = poly(n)again yieldsk ≈ log n / log log n, the same answer23:16,23:33.
flowchart TD
A["Pr[some machine overloaded]"] -->|union bound over m = n machines| B["n · Pr[machine 1 has ≥ k items]"]
B -->|union bound over k-subsets| C["Σ over T, |T| = k : Pr[T all maps to bin 1]"]
C -->|truly random h| D["C(n,k) / n^k ≤ 1/k!"]
D -->|"k! ≥ (k/2)^(k/2)"| E["1/poly(n) when k ≈ log n / log log n"]
The crucial observation for the next topic: this second proof only ever asks about
kitems at a time, never about allnsimultaneously23:33,24:02.