LHD: IMPROVING CACHE HIT RATE BY MAXIMIZING HIT DENSITY
USENIX NSDI 2018 Nathan Beckmann CMU Haoxian Chen
- U. Penn
Asaf Cidon Stanford & Barracuda Networks
LHD: IMPROVING CACHE HIT RATE BY MAXIMIZING HIT DENSITY Nathan - - PowerPoint PPT Presentation
LHD: IMPROVING CACHE HIT RATE BY MAXIMIZING HIT DENSITY Nathan Beckmann Haoxian Chen Asaf Cidon CMU U. Penn Stanford & Barracuda Networks USENIX NSDI 2018 Key-value cache is 100X faster than database Web Server 10 ms 100 s 2
USENIX NSDI 2018 Nathan Beckmann CMU Haoxian Chen
Asaf Cidon Stanford & Barracuda Networks
2
Web Server 100 µs 10 ms
3
[Waldspurger, ATC ‘17]
4
5
6
7
… A B B A C B A B D A B C D A B C B …
… Space ⇒ Time ⇒ X B Y A B B B A Y X B A Y X A A B Y X B Y
Hit! ☺
C A X
Eviction!
8
boxes as possible
resources = area
time spent in cache
A A
… A B B A C B A B D A B C D A B C B …
A A B B B C B D D B B C C … X B Y B A Space ⇒ Time ⇒
Hit! ☺ Eviction!
9
10
Hit density = 𝑷𝒄𝒌𝒇𝒅𝒖′𝒕 𝐢𝐣𝐮 𝐪𝐬𝐩𝐜𝐛𝐜𝐣𝐦𝐣𝐮𝐳 𝑃𝑐𝑘𝑓𝑑𝑢′𝑡 size × 𝑷𝒄𝒌𝒇𝒅𝒖′𝒕 𝐟𝐲𝐪𝐟𝐝𝐮𝐟𝐞 𝐦𝐣𝐠𝐟𝐮𝐣𝐧𝐟
𝐼𝐸 = σ𝑏=1
∞
P[𝐼 = 𝑏] 𝑇𝑗𝑨𝑓 × σ𝑏=1
∞
𝑏 P[𝑀 = 𝑏]
11
𝐟𝐲𝐪𝐟𝐝𝐮𝐟𝐞 𝐦𝐣𝐠𝐟𝐮𝐣𝐧𝐟 𝐢𝐣𝐮 𝐪𝐬𝐩𝐜𝐛𝐜𝐣𝐦𝐣𝐮𝐳
σ𝑦=𝑏
∞
P 𝐼=𝑦 σ𝑦=𝑏
∞
P 𝑀=𝑦
σ𝑦=𝑏
∞
(𝑦−𝑏) P 𝑀=𝑦 σ𝑦=𝑏
∞
P 𝑀=𝑦
12
Candidate age 𝑏 Age Hit probability
13
Common User-specific Best hand-tuned policy for this app: Cache common media + as much user-specific as fits
More popular Less popular
14
15
High hit probability Older objs closer to peak expected lifetime decreases with age Hit density large & increasing Low hit probability Older objects are probably unpopular expected lifetime increases with age Hit density small & decreasing
16
LHD automatically implements the best hand-tuned policy: First, protect the common media, then cache most popular user content
Hit density large & increasing Hit density small & decreasing
17
18
Lower is better!
19
20
21
LHD admits all objects more hits from big objects LHD evicts big objects quickly small objects survive longer more hits
Smallest objects Biggest objects
22
23
24
25
(Even better than CLOCK/FIFO!)
26
A B C D E F G Miss! Sample
A CF E
Lookup hit density (pre-computed)
Evict E
memcached)
classes
Wheel [Li, EuroSys’15]
27
28
CLOCK doesn’t scale when there are even a few misses! RankCache scales well with or without misses! GDSF & LRU don’t scale! Optimization we don’t have time to talk about!
AdaptSize [Berger, NSDI ‘17], Cliffhanger [Cidon, NSDI ‘16]…
Sigmod ‘93]…
29
30
31