Professional Documents
Culture Documents
Computer Systems
Mor Harchol-Balter
Draft -- Do not distribute without permission from the copyright holder, Mor Harchol-Balter
Draft -- Do not distribute without permission from the copyright holder, Mor Harchol-Balter
i
I have always been interested in finding better designs for computer
systems, designs that improve performance without the purchase of
additional resources. When I look back at the problems that I have
solved, and I look ahead to the problems I hope to solve, I realize
that the problem formulations keep getting simpler and simpler, and
my footing less secure. Every wisdom that I once believed, I have
now come to question: If a scheduling policy helps one set of jobs,
does it necessarily hurt some other jobs, or are these conservation laws being misinterpreted? Do greedy routing strategies make
sense in server farms, or is whats good for the individual actually
disastrous for the system as a whole? When comparing a single
fast machine with n slow machines, each of 1/nth the speed, the
single fast machine is typically much more expensive; but does that
mean that it is necessarily better? Should distributed systems really
aim to balance load, or is this a convenient myth? Cycle stealing,
where machines can help each other when they are idle, sounds like
a great idea, but can we quantify the actual benefit? How much is the
performance of scheduling policies affected by variability in the arrival rate and service rate and by fluctuations in the load, and what
can we do to combat variability? Inherent in these questions is the
impact of real user behaviors and real-world workloads with heavytailed, highly variable service demands, as well as correlated arrival
processes. Also intertwined in my work are the tensions between
theoretical analysis and the realities of implementation, each motivating the other. In my search to discover new research techniques
which allow me to answer these and other questions, I find that I
am converging towards the fundamental core that defines all these
problems, and that makes the counter-intuitive more believable.
Draft -- Do not distribute without permission from the copyright holder, Mor Harchol-Balter
Contents
I
Introduction to Queueing
1 Motivating Examples
5
1.1 What is queueing theory? . . . . . . . . . . . . . . . . . . . . . . 5
1.2 Examples of the power of queueing theory . . . . . . . . . . . . . 7
1.3 Combining theory and systems . . . . . . . . . . . . . . . . . . . 16
2 Queueing Theory Terminology
2.1 Where were heading . . . . . . . . . . . . . .
2.2 The single server network . . . . . . . . . . .
2.3 Classification of queueing networks . . . . . .
2.4 Open networks . . . . . . . . . . . . . . . . .
2.5 More metrics: throughput and utilization . .
2.6 Closed networks . . . . . . . . . . . . . . . .
2.6.1 Interactive (terminal-driven) system .
2.6.2 Batch systems . . . . . . . . . . . . .
2.6.3 Throughput in a closed system . . . .
2.7 Differences between closed and open networks
2.7.1 A question on modeling . . . . . . . .
2.8 Related readings . . . . . . . . . . . . . . . .
2.9 Exercises . . . . . . . . . . . . . . . . . . . .
II
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3 Probability Review
3.1 Sample space and events . . . . . . . . . . .
3.2 Probability defined on events . . . . . . . .
3.3 Conditional probabilities and events . . . .
3.4 Law of total probability . . . . . . . . . . .
3.5 Discrete versus continuous random variables
3.6 Probabilities and densities . . . . . . . . . .
3.6.1 Discrete: probability mass function .
19
19
20
23
23
25
30
30
33
34
35
36
36
37
39
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
43
43
44
46
48
50
52
52
ii
Draft -- Do not distribute without permission from the copyright holder, Mor Harchol-Balter
CONTENTS
3.7
3.8
3.9
3.10
3.11
3.12
3.13
3.14
iii
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
55
59
64
66
69
72
74
78
81
84
86
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
93
93
94
95
97
97
100
104
104
105
.
.
.
.
.
.
.
.
.
.
.
107
108
113
115
115
116
116
119
121
121
122
122
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
III The Predictive Power of Simple Operational Laws: WhatIf Questions and Answers
125
6 Operational Laws
6.1 Littles law for open systems
129
. . . . . . . . . . . . . . . . . . . . 129
Draft -- Do not distribute without permission from the copyright holder, Mor Harchol-Balter
iv
CONTENTS
6.2
6.3
6.4
Intuitions . . . . . . . . . . . . . . . . . . . .
Littles law for closed systems . . . . . . . . .
Open systems . . . . . . . . . . . . . . . . . .
6.4.1 Corollaries . . . . . . . . . . . . . . .
6.5 Closed systems . . . . . . . . . . . . . . . . .
6.5.1 Statement . . . . . . . . . . . . . . . .
6.5.2 Proof . . . . . . . . . . . . . . . . . .
6.6 Generalized Littles law . . . . . . . . . . . .
6.7 Examples applying Littles law . . . . . . . .
6.8 More operational laws: The forced flow law .
6.9 Combining operational laws . . . . . . . . . .
6.10 Device demands . . . . . . . . . . . . . . . . .
6.11 Readings and further topics related to Littles
6.12 Exercises . . . . . . . . . . . . . . . . . . . .
7 Modification Analysis
7.1 Review . . . . . . . . . . . . . . . . . . .
7.2 Asymptotic bounds for closed systems .
7.3 Modification analysis for closed systems
7.4 More modification analysis examples . .
7.5 Comparison of closed and open networks
7.6 Readings . . . . . . . . . . . . . . . . . .
7.7 Exercises . . . . . . . . . . . . . . . . .
IV
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
law
. . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
130
130
131
136
138
138
138
140
140
144
147
150
152
152
.
.
.
.
.
.
.
155
156
157
161
163
167
168
168
173
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
177
179
179
180
180
181
182
183
186
187
190
190
191
192
Draft -- Do not distribute without permission from the copyright holder, Mor Harchol-Balter
CONTENTS
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
203
203
205
205
210
212
213
214
222
224
226
230
232
234
235
242
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
247
247
247
251
254
255
255
256
257
257
259
261
262
262
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
265
266
267
270
273
Chains
. . . . .
. . . . .
. . . . .
. . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Draft -- Do not distribute without permission from the copyright holder, Mor Harchol-Balter
vi
CONTENTS
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
275
275
277
280
281
285
290
291
294
295
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
299
299
305
310
310
312
313
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
315
315
320
323
328
328
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
337
338
340
344
351
353
353
361
362
364
364
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Draft -- Do not distribute without permission from the copyright holder, Mor Harchol-Balter
CONTENTS
16.2.2 A first-cut at a capacity provisioning
16.3 Square-root staffing . . . . . . . . . . . . . .
16.4 Readings . . . . . . . . . . . . . . . . . . . .
16.5 Exercises . . . . . . . . . . . . . . . . . . .
vii
rule
. . .
. . .
. . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
366
367
371
371
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
373
374
374
376
378
382
384
386
389
390
390
. . . .
work
. . . .
. . . .
. . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
391
391
393
396
403
403
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
407
407
408
411
414
417
423
432
433
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
435
435
437
439
441
441
443
452
.
.
.
.
.
.
.
.
Draft -- Do not distribute without permission from the copyright holder, Mor Harchol-Balter
viii
CONTENTS
20.5 Exercises
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
459
459
461
464
465
466
467
468
469
.
.
.
.
.
.
.
.
.
.
.
.
473
474
479
483
484
484
485
488
489
490
491
495
496
.
.
.
.
.
.
.
.
.
.
499
499
500
500
502
505
506
514
518
518
519
Draft -- Do not distribute without permission from the copyright holder, Mor Harchol-Balter
CONTENTS
24 M/G/1 Queue & Inspection Paradox
24.1 The inspection paradox . . . . . . . .
24.2 The M/G/1 queue and its analysis . .
24.3 Renewal-reward theory . . . . . . . . .
24.4 Deriving expected excess . . . . . . . .
24.5 Back to the inspection paradox . . . .
24.6 Back to the M/G/1 queue . . . . . . .
24.7 Exercises . . . . . . . . . . . . . . . .
ix
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
26 Transform Analysis
26.1 Definitions of transforms and some examples . .
26.2 Getting moments from transforms . . . . . . . .
26.3 Linearity of transforms . . . . . . . . . . . . . . .
26.4 Conditioning . . . . . . . . . . . . . . . . . . . .
26.4.1 Example: Distribution of response time in
26.5 Combining Laplace and z-transforms . . . . . . .
26.6 More results on transforms* . . . . . . . . . . . .
26.7 Readings . . . . . . . . . . . . . . . . . . . . . . .
26.8 Exercises . . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
521
522
522
526
529
532
534
535
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
539
541
554
560
565
568
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
an M/M/1
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
573
573
577
581
584
585
586
588
590
590
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
593
593
593
598
601
601
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
603
604
606
610
614
616
616
.
.
.
.
.
.
.
.
.
.
.
.
Draft -- Do not distribute without permission from the copyright holder, Mor Harchol-Balter
VII
CONTENTS
Smart Scheduling
619
29 Performance Metrics
29.1 Traditional metrics . . . . . . . . . . . . .
29.2 Commonly-used metrics for single queues
29.3 Todays trendy metrics . . . . . . . . . . .
29.4 Starvation/fairness metrics . . . . . . . .
29.5 Deriving performance metrics . . . . . . .
30 Non-Preemptive, Non-Size-Based
30.1 FCFS, LCFS, and RANDOM . .
30.2 Readings . . . . . . . . . . . . . .
30.3 Exercises . . . . . . . . . . . . .
.
.
.
.
.
623
623
624
625
626
627
Policies
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
629
629
634
635
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
637
637
637
639
640
643
644
646
649
655
655
656
658
664
664
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
679
679
680
685
688
691
693
Draft -- Do not distribute without permission from the copyright holder, Mor Harchol-Balter
CONTENTS
34.1 Shortest Remaining Processing Time (SRPT)
34.2 Precise derivation of SRPT waiting time* . .
34.3 Comparisons with other policies . . . . . . . .
34.3.1 Comparison with PSJF . . . . . . . .
34.3.2 SRPT versus FB . . . . . . . . . . . .
34.3.3 Comparison of all scheduling policies .
34.4 Fairness of SRPT . . . . . . . . . . . . . . . .
34.5 Readings . . . . . . . . . . . . . . . . . . . . .
xi
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
693
697
700
701
701
702
705
710
Draft -- Do not distribute without permission from the copyright holder, Mor Harchol-Balter