Reconciling ¡High ¡Server ¡U0liza0on ¡ and ¡ Sub-‑millisecond ¡Quality-‑of-‑Service ¡
Jacob ¡Leverich ¡and ¡Christos ¡Kozyrakis, ¡ Stanford ¡University ¡ ¡ EuroSys ¡’14, ¡April ¡14th, ¡2014 ¡
1 ¡
Reconciling High Server U0liza0on and Sub-millisecond - - PowerPoint PPT Presentation
Reconciling High Server U0liza0on and Sub-millisecond Quality-of-Service Jacob Leverich and Christos Kozyrakis, Stanford University EuroSys 14, April
1 ¡
0" 0.005" 0.01" 0.015" 0.02" 0.025" 0.03" 0.0" 0.1" 0.2" 0.3" 0.4" 0.5" 0.6" 0.7" 0.8" 0.9" 1.0" Frac%on(of(%me( CPU(u%liza%on(
2 ¡
[Barroso ¡and ¡Holzle, ¡2007] ¡ Industry ¡average ¡[McKinsey’09] ¡ Amazon ¡EC2 ¡[Liu, ¡CGC’11] ¡
3 ¡
4 ¡
Cores ¡ 20% ¡ Memory ¡ 70% ¡ Memcached? ¡ Cores ¡ 85% ¡ Memory ¡ 30% ¡ Analy0cs? ¡
5 ¡
6 ¡
– Queuing ¡delay, ¡scheduling ¡delay, ¡thread ¡load ¡imbalance ¡
– Queuing ¡delay: ¡ ¡ ¡Interference-‑aware ¡provisioning ¡ – Scheduling ¡delay: ¡ ¡ ¡Use ¡alterna0ves ¡to ¡CFS ¡ – Thread ¡load ¡imbalance: ¡Dynamically ¡share ¡connec0ons/requests ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡[or ¡pin ¡threads] ¡ – Network ¡interference: ¡NIC ¡receive-‑flow ¡steering ¡
7 ¡
8 ¡
9 ¡
8 switch ¡
wire ¡
NIC ¡ 4 5 6 7
wire ¡
11 ¡ 3 9 8 IRQ ¡ Kernel ¡ Syscall ¡ NIC ¡
wire ¡
switch ¡ 1 3 TX ¡ Write ¡ 2 TCP/IP ¡ 11 ¡ User ¡ NIC ¡ 4 5 6 RX ¡ TCP/IP ¡ 9 ¡ 11 ¡ Epoll ¡ Read ¡ 13 ¡ Write ¡ 14 ¡ 15 ¡ TCP/IP ¡ TX ¡ 8 Schedule ¡ NIC ¡ 7 Ac0vate ¡ 12 ¡ Memcached ¡
GET ¡foo ¡ 10 ¡ libevent ¡ VALUE ¡foo ¡ bar ¡ END ¡
3 9 8 IRQ ¡ Kernel ¡ Syscall ¡ 11 ¡ User ¡ NIC ¡ 4 5 6 RX ¡ TCP/IP ¡ 9 ¡ 11 ¡ Epoll ¡ Read ¡ 13 ¡ Write ¡ 14 ¡ 15 ¡ TCP/IP ¡ TX ¡ 8 Schedule ¡ NIC ¡ 7 Ac0vate ¡ 12 ¡ Memcached ¡
10 ¡ libevent ¡
10 ¡
~19-‑21usecs ¡(unloaded) ¡ ~10usecs ¡ get ¡FOO ¡
11 ¡
12 ¡
~1M ¡QPS ¡
For ¡1B ¡QPS ¡we ¡need ¡ 1,000 ¡servers ¡@ ¡1M ¡QPS ¡
0" 100" 200" 300" 400" 500" 600" 700" 800" 900" 1000" 3 % " 8 % " 1 4 % " 1 9 % " 2 4 % " 3 % " 3 5 % " 4 1 % " 4 6 % " 5 1 % " 5 7 % " 6 2 % " 6 8 % " 7 3 % " 7 8 % " 8 4 % " 8 9 % " 9 5 % " 1 % " Latency((usecs)( Memcached(QPS((%(of(peak)( Average" 95th5%"
13 ¡
Provisioned ¡QPS ¡ Nominal ¡QPS ¡
Histogram ¡of ¡CPU ¡u5liza5on ¡@ ¡Google ¡[Barroso’07] ¡
0" 100" 200" 300" 400" 500" 600" 700" 800" 900" 1000" 3 % " 8 % " 1 4 % " 1 9 % " 2 4 % " 3 % " 3 5 % " 4 1 % " 4 6 % " 5 1 % " 5 7 % " 6 2 % " 6 8 % " 7 3 % " 7 8 % " 8 4 % " 8 9 % " 9 5 % " 1 % " Latency((usecs)( Memcached(QPS((%(of(peak)( Average" 95th5%"
14 ¡
0" 100" 200" 300" 400" 500" 600" 700" Latency((usecs)( Time((20(seconds)(
15 ¡
Avg ¡ 95th ¡
0" 500" 1,000" 1,500" 2,000" 2,500" 3,000" 3,500" 4,000" Latency((usecs)( Time((20(seconds)(
16 ¡
Old ¡ 95th ¡ 95th ¡ Old ¡ Avg ¡
17 ¡
0" 100" 200" 300" 400" 500" 600" 700" 800" 900" 1000" 3 % " 8 % " 1 4 % " 1 9 % " 2 4 % " 3 % " 3 5 % " 4 1 % " 4 6 % " 5 1 % " 5 7 % " 6 2 % " 6 8 % " 7 3 % " 7 8 % " 8 4 % " 8 9 % " 9 5 % " 1 % " Latency((usecs)( Memcached(QPS((%(of(peak)( Average" 95th5%"
18 ¡
Provisioned ¡QPS ¡
0" 100" 200" 300" 400" 500" 600" 700" 800" 900" 1000" 3 % " 8 % " 1 4 % " 1 9 % " 2 4 % " 3 % " 3 5 % " 4 1 % " 4 6 % " 5 1 % " 5 7 % " 6 2 % " 6 8 % " 7 3 % " 7 8 % " 8 4 % " 8 9 % " 9 5 % " 1 % " Latency((usecs)( Memcached(QPS((%(of(peak)( Average" 95th5%" Average"(w/"L3"int.)" 95th5%"(w/"L3"int.)"
19 ¡
Provisioned ¡QPS ¡ 11 ¡ Read ¡ 13 ¡ Write ¡ 12 ¡ Memcached ¡ ~10usecs ¡ ~16usecs ¡
0" 100" 200" 300" 400" 500" 600" 700" 800" 900" 1000" 3 % " 8 % " 1 4 % " 1 9 % " 2 4 % " 3 % " 3 5 % " 4 1 % " 4 6 % " 5 1 % " 5 7 % " 6 2 % " 6 8 % " 7 3 % " 7 8 % " 8 4 % " 8 9 % " 9 5 % " 1 % " Latency((usecs)( Memcached(QPS((%(of(peak)( Average" 95th5%" Average"(w/"L3"int.)" 95th5%"(w/"L3"int.)"
20 ¡
Provisioned ¡QPS ¡
– Can ¡live ¡with ¡interference, ¡not ¡queuing ¡delay ¡ – Provisioning ¡at ¡80% ¡QPS ¡gave ¡us ¡no ¡margin ¡of ¡error ¡
– 1,300 ¡servers ¡for ¡1B ¡QPS ¡ – Immune ¡to ¡cache ¡interference, ¡free ¡to ¡co-‑schedule ¡jobs ¡ – Plenty ¡of ¡spare ¡capacity ¡for ¡analy0cs ¡cluster ¡workload ¡
(1,000 ¡servers, ¡50% ¡load) ¡
– Achieve ¡good ¡QoS ¡with ¡interference, ¡even ¡at ¡peak! ¡
21 ¡
0" 500" 1,000" 1,500" 2,000" 2,500" 3,000" 3,500" 4,000" Latency((usecs)( Time((20(seconds)(
22 ¡
95th ¡ @ ¡80% ¡ 95th ¡ @ ¡60% ¡
23 ¡
0" 100" 200" 300" 400" 500" 600" 700" 800" 900" 1000" 3%" 13%" 23%" 33%" 44%" 54%" 64%" 74%" 85%" 95%"
95th%%'Latency'(usecs)'
Memcached'QPS'(%'of'Peak)'
Memcached"alone"
24 ¡
Core ¡
SPEC ¡ NIC ¡
25 ¡
Core ¡
SPEC ¡ NIC ¡
0" 100" 200" 300" 400" 500" 600" 700" 800" 900" 1000" 3%" 13%" 23%" 33%" 44%" 54%" 64%" 74%" 85%" 95%"
95th%%'Latency'(usecs)'
Memcached'QPS'(%'of'Peak)'
Memcached"alone" 400.perlbench"
26 ¡
0" 100" 200" 300" 400" 500" 600" 700" 800" 900" 1000" 3%" 13%" 23%" 33%" 44%" 54%" 64%" 74%" 85%" 95%"
95th%%'Latency'(usecs)'
Memcached'QPS'(%'of'Peak)'
Memcached"alone" 400.perlbench" 410.bwaves" 416.gamess" 429.mcf" 433.milc" 459.GemsFDTD" 450.soplex" 470.lbm" 471.omnetpp" 401.bzip2" 403.gcc" 434.zeusmp"
27 ¡
28 ¡
90 ¡ 80 ¡ 70 ¡ 60 ¡ 50 ¡ 40 ¡ 30 ¡ 20 ¡ 10 ¡ 10 ¡ 20 ¡ 30 ¡ 40 ¡ 50 ¡ 60 ¡ 70 ¡ 80 ¡ 90 ¡
Memcached ¡Load ¡(% ¡Peak ¡QPS) ¡ 1ms ¡RPC-‑service ¡Load ¡(% ¡Peak ¡QPS) ¡
Achieved ¡QoS ¡w/ ¡two ¡low-‑latency ¡workloads ¡ Both ¡meet ¡QoS ¡ 1ms ¡service ¡fails ¡ Memcached ¡fails ¡ Both ¡fail ¡to ¡meet ¡QoS ¡ QoS ¡requirement ¡ = ¡95th ¡< ¡5x ¡low-‑load ¡95th ¡
Bad ¡QoS ¡with ¡minor ¡ interference! ¡
0" 2000" 4000" 6000" 8000" 10000" 12000" 3%" 8%" 13%" 18%" 24%" 29%" 34%" 39%" 45%" 50%" 55%" 61%" 66%" 71%" 76%" 82%" 87%" 92%" 97%" 95th%%'Latency'(usecs)' Memcached'QPS'(%'of'Peak)' No"Interference" CFS"
29 ¡
Interference ¡w/ ¡CFS ¡ No ¡interference ¡
30 ¡
A ¡B ¡
0me ¡ ¡
L ¡ C ¡
0" 2000" 4000" 6000" 8000" 10000" 12000" 3%" 8%" 13%" 18%" 24%" 29%" 34%" 39%" 45%" 50%" 55%" 61%" 66%" 71%" 76%" 82%" 87%" 92%" 97%" 95th%%'Latency'(usecs)' Memcached'QPS'(%'of'Peak)' No"Interference" CFS"
31 ¡
Interference ¡w/ ¡CFS ¡
Square ¡
0me ¡ ¡
Memcached ¡
No ¡interference ¡
0" 2000" 4000" 6000" 8000" 10000" 12000" 3%" 8%" 13%" 18%" 24%" 29%" 34%" 39%" 45%" 50%" 55%" 61%" 66%" 71%" 76%" 82%" 87%" 92%" 97%" 95th%%'Latency'(usecs)' Memcached'QPS'(%'of'Peak)' No"Interference" CFS"
32 ¡
Interference ¡w/ ¡CFS ¡
Square ¡
0me ¡ ¡
Memcached ¡
No ¡interference ¡
33 ¡
A ¡ B ¡ B’ ¡ 0me ¡ ¡ L ¡ warp(B) ¡= ¡0 ¡ A’ ¡ Task ¡A ¡not ¡interrupted ¡by ¡B ¡waking ¡up ¡ ¡
warp(A) ¡> ¡L ¡
0" 2000" 4000" 6000" 8000" 10000" 12000" 3%" 8%" 13%" 18%" 24%" 29%" 34%" 39%" 45%" 50%" 55%" 61%" 66%" 71%" 76%" 82%" 87%" 92%" 97%" 95th%%'Latency'(usecs)' Memcached'QPS'(%'of'Peak)' No"Interference" CFS" BVT"
34 ¡
50% ¡share ¡
Interference ¡w/ ¡CFS ¡ Interference ¡w/ ¡BVT ¡ No ¡interference ¡
35 ¡
90 ¡ 80 ¡ 70 ¡ 60 ¡ 50 ¡ 40 ¡ 30 ¡ 20 ¡ 10 ¡ 10 ¡ 20 ¡ 30 ¡ 40 ¡ 50 ¡ 60 ¡ 70 ¡ 80 ¡ 90 ¡
Memcached ¡Load ¡(% ¡Peak ¡QPS) ¡ 1ms ¡RPC-‑service ¡Load ¡(% ¡Peak ¡QPS) ¡
Achieved ¡QoS ¡w/ ¡two ¡low-‑latency ¡workloads ¡ Both ¡meet ¡QoS ¡ 1ms ¡service ¡fails ¡ Memcached ¡fails ¡ Both ¡fail ¡to ¡meet ¡QoS ¡ QoS ¡requirement ¡ = ¡95th ¡< ¡5x ¡low-‑load ¡95th ¡
¡init/Kconfig ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡| ¡ ¡ ¡14 ¡+++++++++++ ¡ ¡kernel/sched/core.c ¡ ¡ ¡ ¡ ¡| ¡ ¡ ¡31 ¡+++++++++++++++++++++++ ¡ ¡kernel/sched/fair.c ¡ ¡ ¡ ¡ ¡| ¡ ¡ ¡93 ¡++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++-‑-‑-‑ ¡ ¡kernel/sched/features.h ¡| ¡ ¡ ¡ ¡2 ¡++ ¡ ¡kernel/sched/sched.h ¡ ¡ ¡ ¡| ¡ ¡ ¡ ¡4 ¡+++ ¡ ¡kernel/sysctl.c ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡| ¡ ¡ ¡ ¡9 ¡+++++++ ¡ ¡7 ¡files ¡changed, ¡158 ¡insertions(+), ¡3 ¡deletions(-‑) ¡
36 ¡
– Queuing ¡delay, ¡scheduling ¡delay, ¡thread ¡load ¡imbalance ¡
– Queuing ¡delay: ¡ ¡ ¡Interference-‑aware ¡provisioning ¡ – Scheduling ¡delay: ¡ ¡ ¡Use ¡alterna0ves ¡to ¡CFS ¡ – Thread ¡load ¡imbalance: ¡Dynamically ¡share ¡connec0ons/requests ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡[or ¡pin ¡threads] ¡ – Network ¡interference: ¡NIC ¡receive-‑flow ¡steering ¡
37 ¡
– Queuing ¡delay, ¡scheduling ¡delay, ¡thread ¡load ¡imbalance ¡
– Queuing ¡delay: ¡ ¡ ¡Interference-‑aware ¡provisioning ¡ – Scheduling ¡delay: ¡ ¡ ¡Use ¡alterna0ves ¡to ¡CFS ¡ – Thread ¡load ¡imbalance: ¡Dynamically ¡share ¡connec0ons/requests ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡[or ¡pin ¡threads] ¡ – Network ¡interference: ¡NIC ¡receive-‑flow ¡steering ¡
38 ¡
39 ¡
40 ¡
41 ¡
42 ¡
User% 17%% System% 52%% So0IRQ% 31%%
43 ¡
Memcached ¡CPU ¡0me ¡ Only ¡part ¡affected ¡ by ¡TLB ¡flush ¡
44 ¡
0" 0.05" 0.1" 0.15" 0.2" 0.25" 0.3" 0.35" 0.4" 4 . p e r l b e n c h " 4 1 . b w a v e s " 4 3 . g c c " 4 3 4 . z e u s m p " 4 3 3 . m i l c " 4 1 6 . g a m e s s " 4 2 9 . m c f " 4 1 . b z i p 2 " 4 7 . l b m " 4 5 . s
l e x " 4 5 9 . G e m s F D T D " 4 7 1 .
n e t p p " Normalized+Performance+
Performance+of+background+task+
Inefficiency ¡ Bejer ¡trade-‑off ¡than ¡3x ¡over-‑reserva0on ¡
45 ¡
46 ¡
47 ¡
– We ¡track ¡individual ¡connec0ons ¡to ¡record ¡per-‑request ¡latency ¡
Who ¡ What ¡ Low ¡load ¡ Overload ¡
Server ¡
RX ¡ 0.9us ¡ 1us ¡ TCP/IP ¡ 4.7us ¡ 4us ¡ epoll() ¡return ¡ 3.9us ¡ 2778us ¡ libevent ¡ 2.4us ¡ 3074us ¡ read() ¡call/ret ¡ 2.5us ¡ 5us ¡ ¡ ¡ ¡ ¡memcached ¡ 2.5us ¡ 2us ¡ write()+TX ¡ 4.6us ¡ 4us ¡ Total ¡ 21.5us ¡ 5872us ¡
Client ¡
End-‑to-‑End ¡ 49.8us ¡ 6011us ¡
48 ¡
– We ¡track ¡individual ¡connec0ons ¡to ¡record ¡per-‑request ¡latency ¡
Who ¡ What ¡ Low ¡load ¡ Overload ¡
Server ¡
RX ¡ 0.9us ¡ 1us ¡ TCP/IP ¡ 4.7us ¡ 4us ¡ epoll() ¡return ¡ 3.9us ¡ 2778us ¡ libevent ¡ 2.4us ¡ 3074us ¡ read() ¡call/ret ¡ 2.5us ¡ 5us ¡ ¡ ¡ ¡ ¡memcached ¡ 2.5us ¡ 2us ¡ write()+TX ¡ 4.6us ¡ 4us ¡ Total ¡ 21.5us ¡ 5872us ¡
Client ¡
End-‑to-‑End ¡ 49.8us ¡ 6011us ¡
49 ¡
Queue ¡#1: ¡Epoll ¡ready ¡list ¡ Queue ¡#2: ¡Libevent ¡ ¡internal ¡event ¡list ¡
50 ¡
Who ¡ What ¡ Low ¡load ¡ Overload ¡ + ¡L3 ¡Int. ¡
Server ¡
RX ¡ 0.9us ¡ 1us ¡ 1us ¡ TCP/IP ¡ 4.7us ¡ 4us ¡ 4us ¡ epoll() ¡return ¡ 3.9us ¡ 2778us ¡ 3780us ¡ libevent ¡ 2.4us ¡ 3074us ¡ 4545us ¡ read() ¡call/ret ¡ 2.5us ¡ 5us ¡ 7us ¡ ¡ ¡ ¡ ¡memcached ¡ 2.5us ¡ 2us ¡ 4us ¡ write()+TX ¡ 4.6us ¡ 4us ¡ 5us ¡ Total ¡ 21.5us ¡ 5872us ¡ 8349us ¡
Client ¡
End-‑to-‑End ¡ 49.8us ¡ 6011us ¡ 8460us ¡ TX-‑to-‑RX ¡ 36us ¡
Switch ¡
RX-‑to-‑TX ¡ 3us ¡
probe kernel.function( "tcp_rcv_established@net/ipv4/tcp_input.c” ).return { tstamps[$sk,"tcpip_rx"] = gettimeofday_ns() }
51 ¡
52 ¡
Core ¡1 ¡ Core ¡2 ¡ Core ¡3 ¡ Core ¡4 ¡ App ¡A ¡ App ¡A ¡ App ¡B ¡ App ¡B ¡ NIC ¡ RX ¡hash ¡
53 ¡
NIC Configuration Network Traffic 1Gbps
Receive-side scaling (rx hashing) 24% Memcached ¡QPS ¡loss ¡ due ¡to ¡concurrent ¡ network ¡traffic ¡
54 ¡
Core ¡1 ¡ Core ¡2 ¡ Core ¡3 ¡ Core ¡4 ¡ App ¡A ¡ App ¡A ¡ App ¡B ¡ App ¡B ¡ NIC ¡ RX ¡hash ¡
55 ¡
NIC Configuration Network Traffic 1Gbps
Receive-side scaling (rx hashing) 24% Receive-flow steering (rx follows tx) 1% Memcached ¡QPS ¡loss ¡ due ¡to ¡concurrent ¡ network ¡traffic ¡
56 ¡
0" 1000" 2000" 3000" 4000" 5000" 6000" 7000" 8000" 9000" 10000" "50,000"" "100,000"" "150,000"" "200,000"" "250,000"" "300,000"" "350,000"" "400,000"" "450,000"" "500,000"" "550,000"" "600,000"" "650,000"" "700,000"" "750,000"" "800,000"" "850,000"" "900,000"" "950,000"" "1,000,000"" !Latency!(usecs)! Memcached!QPS!
Latency!vs.!QPS!(#!threads!=!#!cores!+!1)!
TCP"(95th3%)" TCP"(50th3%)"
57 ¡
At ¡least ¡one ¡core ¡has ¡ >1 ¡thread ¡at ¡all ¡0mes! ¡
0" 1000" 2000" 3000" 4000" 5000" 6000" 7000" 8000" 9000" 10000" "50,000"" "100,000"" "150,000"" "200,000"" "250,000"" "300,000"" "350,000"" "400,000"" "450,000"" "500,000"" "550,000"" "600,000"" "650,000"" "700,000"" "750,000"" "800,000"" "850,000"" "900,000"" "950,000"" "1,000,000"" !Latency!(usecs)! Memcached!QPS!
Latency!vs.!QPS!(#!threads!=!#!cores)!
TCP"(95th3%)" TCP"(50th3%)"
58 ¡
Due ¡to ¡spurious ¡thread ¡migra5on! ¡ (i.e. ¡affine ¡wakeups, ¡ wakeup ¡load ¡balancing, ¡ background ¡daemons) ¡
Occasionally ¡ 2 ¡threads ¡on ¡1 ¡core, ¡
0" 1000" 2000" 3000" 4000" 5000" 6000" 7000" 8000" 9000" 10000" "50,000"" "100,000"" "150,000"" "200,000"" "250,000"" "300,000"" "350,000"" "400,000"" "450,000"" "500,000"" "550,000"" "600,000"" "650,000"" "700,000"" "750,000"" "800,000"" "850,000"" "900,000"" "950,000"" "1,000,000"" !95th&%!Latency!(usecs)! Memcached!QPS!
Latency!vs.!QPS!(#!threads!=!#!cores)!
TCP" TCP+Pin"
59 ¡
Pin ¡= ¡sched_setaffinity() ¡to ¡ assign ¡threads ¡to ¡specific ¡cores ¡
0" 1000" 2000" 3000" 4000" 5000" 6000" 7000" 8000" 9000" 10000" "50,000"" "100,000"" "150,000"" "200,000"" "250,000"" "300,000"" "350,000"" "400,000"" "450,000"" "500,000"" "550,000"" "600,000"" "650,000"" "700,000"" "750,000"" "800,000"" "850,000"" "900,000"" "950,000"" "1,000,000"" !95th&%!Latency!(usecs)! Memcached!QPS!
Latency!vs.!QPS!(#!threads!=!#!cores)!
TCP" TCP+Pin" UDP"
60 ¡
Most ¡load ¡generated ¡w/ ¡TCP, ¡ UDP ¡latency ¡sampled ¡at ¡1kHz ¡ (dozens ¡of ¡UDP ¡client ¡conns.) ¡
0" 1000" 2000" 3000" 4000" 5000" 6000" 7000" 8000" 9000" 10000" "50,000"" "100,000"" "150,000"" "200,000"" "250,000"" "300,000"" "350,000"" "400,000"" "450,000"" "500,000"" "550,000"" "600,000"" "650,000"" "700,000"" "750,000"" "800,000"" "850,000"" "900,000"" "950,000"" "1,000,000"" !Latency!(usecs)! Memcached!QPS!
Latency!vs.!QPS!(#!threads!=!#!cores!+!1)!
TCP"(95th3%)" TCP"(50th3%)" UDP"(95th3%)"
61 ¡
At ¡least ¡one ¡core ¡has ¡ >1 ¡thread ¡at ¡all ¡0mes! ¡
Listen ¡ Thread ¡ Worker ¡ Thread ¡ Worker ¡ Thread ¡ Worker ¡ Thread ¡ Worker ¡ Thread ¡ Epoll ¡Set ¡ Epoll ¡Set ¡ Epoll ¡Set ¡ Epoll ¡Set ¡
UDP ¡
62 ¡
Core ¡1 ¡ Core ¡2 ¡ Core ¡2 ¡ Core ¡3 ¡
UDP ¡ UDP ¡ UDP ¡
63 ¡
64 ¡
Aggregator ¡ Leaf ¡ Leaf ¡ Leaf ¡ Leaf ¡
Query: ¡“Funniest ¡movie ¡ever” ¡ Clueless ¡(0.6) ¡
65 ¡
Data ¡ Data ¡ Data ¡ Data ¡
66 ¡
Completely ¡Fair ¡ Scheduler ¡ POSIX ¡Real5me ¡ + ¡Bandwidth ¡Limit ¡ BVT ¡[Duda’99] ¡ + ¡Grace ¡Period ¡
Reserva5ons ¡
Configurable ¡ preemp5on ¡
Work ¡ conserving ¡
Memcached ¡ 1ms ¡latency-‑sensi0ve ¡task ¡
– Be ¡mindful ¡of ¡socket ¡lock ¡conten0on… ¡ – Thundering ¡herd; ¡don’t ¡put ¡socket ¡in ¡EVERY ¡set ¡
– Edge-‑triggered ¡or ¡EPOLL_ONESHOT ¡to ¡avoid ¡thundering ¡herd ¡ – Not ¡supported ¡by ¡libevent ¡ – Be ¡mindful ¡of ¡event ¡set ¡lock ¡conten0on… ¡
– Pisces ¡[Shue ¡et ¡al., ¡OSDI’12] ¡
– Maintain ¡thread-‑safe ¡queue ¡of ¡events ¡returned ¡by ¡epoll_wait() ¡ – Steal ¡events ¡from ¡neighbors ¡when ¡idle ¡
67 ¡
68 ¡