learning relaxed belady for cdn caching

30
Learning Relaxed Belady for CDN Caching COS 316: Principles of Computer System Design Lecture 10 Amit Levy & Wyatt Lloyd

Upload: others

Post on 16-Oct-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Learning Relaxed Belady for CDN Caching

LearningRelaxedBeladyforCDNCaching

COS316:PrinciplesofComputerSystemDesignLecture10

AmitLevy&WyattLloyd

Page 2: Learning Relaxed Belady for CDN Caching

EdgeCachewithDifferentAlgos

• Clairvoyant (Bélády) shows we can do much better!

��

��

��

��

��

��

� �� ��

���������

����������

�������������������

�������

Infinite Cache

Page 3: Learning Relaxed Belady for CDN Caching

3

CuttingEdgeResearchFromPrinceton!LearningRelaxedBelady forContentDistributionNetworkCaching.

Zhenyu Song,DanielS.Berger,KaiLi,andWyattLloyd.

In17thUSENIXSymposiumonNetworkedSystemsDesignandImplementation(NSDI20),February2020.

Page 4: Learning Relaxed Belady for CDN Caching

Edgecache

CDNCachingGoal:MinimizeWANTrafficRequests

MissHit

User

Requests

WideAreaNetwork(WAN)trafficisexpensive

Keymetrichitratio

4

Page 5: Learning Relaxed Belady for CDN Caching

CachingRemainsChallengingHeuristic-basedalgorithms(1965–):LRU,LFU,GDSF,ARC,...● Workwellforsomeworkloads,butworkpoorlyforother

ML-basedadaptationofheuristics(2017–):UCB,LeCAR,...● Alsoworkwellforsomeworkloads,butpoorlyforothers

TheBelady algorithm(1966)● Offlineoptimal:requiresfutureknowledge● Largegapinmissratiobetweenstate-of-the-artandBelady:● 20–40%onproductiontraces

5

Page 6: Learning Relaxed Belady for CDN Caching

IntroducingLearningRelaxedBelady(LRB)

Newapproach:mimicBelady usingmachinelearning

6

● Machine-Learning-for-Systems(ML-for-Systems)○ Enablingtechnologies

○ Whendoesitmakesense?

Page 7: Learning Relaxed Belady for CDN Caching

GeneralOverviewofourApproach

R R R R R R·········

Now

Cache

R

Pastinformation

MLarchitecture

Trainingdata

Evictioncandidates

7

Page 8: Learning Relaxed Belady for CDN Caching

Challenge1:PastInformation

R R R R R R·········

Now

Cache

RWhatpastinformationtouse?

Pastinformation

MLarchitecture

Trainingdata

Evictioncandidates

8

Moredataimprovestrainingbutincreasesmemory overhead

Page 9: Learning Relaxed Belady for CDN Caching

Challenge2:GenerateOnlineTrainingData

R R R R R R·········

Now

Cache

RWhatpastinformationtouse?

Generateonlinetrainingdata?

Pastinformation

MLarchitecture

Trainingdata

Evictioncandidates

9

Page 10: Learning Relaxed Belady for CDN Caching

Challenge3:MLArchitecture

R R R R R R·········

Now

Cache

RWhatpastinformationtouse?

Generateonlinetrainingdata?

WhatMLarchitecturetoselect?

Pastinformation

MLarchitecture

Trainingdata

Evictioncandidates

10

Largedesignspace:features,model,predictiontarget,lossfunction

Page 11: Learning Relaxed Belady for CDN Caching

Challenge4:EvictionCandidates

R R R R R R·········

Now

Cache

R

Pastinformation

MLarchitecture

Trainingdata

Evictioncandidates

Howtoselectevictcandidates?

Whatpastinformationtouse?

Generateonlinetrainingdata?

WhatMLarchitecturetoselect?

11

Page 12: Learning Relaxed Belady for CDN Caching

Solution:RelaxedBelady Algorithm

Howtoselectevictcandidates?

Whatpastinformationtouse?

Generateonlinetrainingdata?

WhatMLarchitecturetoselect?RelaxedBeladyalgorithm

16

Page 13: Learning Relaxed Belady for CDN Caching

Challenge:HardtoMimicBelady Algorithm

MimickingexactBeladyisimpractical● Needpredictionsforallobjects→prohibitivecomputationalcost● Needexactpredictionofnextaccess→furtherpredictionareharder

Belady:evictobjectwithnextaccessfarthestinthefuture

17

Cache(now)

A······

B

C D

Timetonextrequest

D B A C······ ······

Evict

Page 14: Learning Relaxed Belady for CDN Caching

IntroducingtheRelaxedBeladyAlgorithm

Observation:manyobjectsaregoodcandidatesforeviction

RelaxedBelady evictsa random objectbeyondboundary

18

Cache(now)

A······

B

C D

Timetonextrequest

D B A C······ ······

EvictBeladyboundary

● Donotneedpredictionsforallobjects→reasonablecomputation● Noneedtodifferentiatebeyondboundary→simplifiestheprediction

Page 15: Learning Relaxed Belady for CDN Caching

Challenge1:PastInformation

R R R R R R·········

MLarchitecture

Trainingdata

Evictioncandidates

Moredataimprovestrainingbutincreasesmemory overhead

PastinformationWhatpastinformationtouse?Now

Cache

R

22

Page 16: Learning Relaxed Belady for CDN Caching

TrackObjectswithinaSlidingMemoryWindow

Perobjectfeatures

R R R R R R·········

Now

R

Slidingmemorywindow mimicsBeladyboundary

Onlytrackobjectswithinmemorywindow

23

WindowsizeisLRB’smainhyperparameter

Page 17: Learning Relaxed Belady for CDN Caching

Challenge2:TrainingData

R R R R R R·········

Now

Cache

RWhatpastinformationtouse?

Generateonlinetrainingdata?

Pastinformation

MLarchitecture

Trainingdata

Evictioncandidates

24

Page 18: Learning Relaxed Belady for CDN Caching

SampleTrainingData&LabelonAccessorBoundary

Perobjectfeatures

R R R R R R·········

Now

R

Slidingmemorywindow

Sample

Unlabeledtrainingdata

Past memorywindowAccess

Labeledtrainingdata

25

Page 19: Learning Relaxed Belady for CDN Caching

Challenge3:MLArchitecture

Largepotentialdesignspace

R R R R R R·········

Now

Cache

RWhatpastinformationtouse?

Generateonlinetrainingdata?

WhatMLarchitecturetoselect?

Pastinformation

MLarchitecture

Trainingdata

Evictioncandidates

26

Page 20: Learning Relaxed Belady for CDN Caching

Solution3:Feature&ModelSelection

Gradientboostingdecisiontrees

Lightweight &highgooddecisionratio

Training~300ms,prediction~30us

Features

Objectsize

Objecttype

Inter-requestdistances(recency)

Exponentialdecaycounters(long-termfrequencies)

Usegooddecisionratiotoevaluatenewdesigns

27

Page 21: Learning Relaxed Belady for CDN Caching

Challenge4:EvictionCandidates

R R R R R R·········

Now

Cache

R

Pastinformation

MLarchitecture

Trainingdata

Evictioncandidates

Howtoselectevictcandidates?

Whatpastinformationtouse?

Generateonlinetrainingdata?

WhatMLarchitecturetoselect?

28

Page 22: Learning Relaxed Belady for CDN Caching

Solution4:RandomSamplingforEviction

CanmimicrelaxedBeladyifwecanfind1objectbeyondtheboundary

k=64candidates;moredoesnotimprovegooddecisionratio

R R R R R R·········

Now

Cache

R

Pastinformation

Randomkcandidates

29

Page 23: Learning Relaxed Belady for CDN Caching

Label

Labeleddataset

Sample

Unlabeleddataset

LearningRelaxedBelady

30

Now

Cache

RR R R R R R······

Memorywindow

RR

Train

Model EvictionCandidates

···

Sample

Predict

Evict

Page 24: Learning Relaxed Belady for CDN Caching

● Simulatorimplementation○ LRB+14otheralgorithms

● Prototypeimplementation○ C++ontopofproductionsystem(ApacheTrafficServer)○ Manyoptimizations

Implementation

31

Page 25: Learning Relaxed Belady for CDN Caching

● Q1:LearningRelaxedBelady(LRB)trafficreductionvsstate-of-the-art

● Q2:overheadofLRBvsCDNproductionsystem

● Traces:6productiontracesfrom3CDNs

● Hyperparameter(memorywindow/model/...)tunedon20%oftrace

EvaluationSetup

32

Page 26: Learning Relaxed Belady for CDN Caching

LRBReducesWANTraffic20%trafficreductionoverB-LRU10%reductionoverthebestSOA

Wikipediatrace

Industrystandard

33

Page 27: Learning Relaxed Belady for CDN Caching

CDN-B1 CDN-B3CDN-B2

LRBConsistentlyImprovesontheStateoftheArt

Wikipedia CDN-A1 CDN-A2

34

Page 28: Learning Relaxed Belady for CDN Caching

LRBOverheadIsModest

Throughput:11.7Gbpsvs11.7Gbps(unmodified)

Memoryoverhead=1‒3%cachesize

PeakCPU:16%vs9%(unmodified)

35

Edgecache

Requests

User

Page 29: Learning Relaxed Belady for CDN Caching

Conclusion

● LRBreducesWANtrafficwithmodestoverhead

● ML-for-systemsgenerallypromisingtoreplaceheuristics

● Keyinsight:relaxedBelady

→ Simplifiesmachinelearning&reducessystemoverhead

36

Page 30: Learning Relaxed Belady for CDN Caching