arc: a self-tuning, low overhead replacement cache nimrod megiddo and dharmendra s. modha presented...

33
ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

Upload: zion-millage

Post on 30-Mar-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

ARC: A self-tuning, low overhead Replacement Cache

Nimrod Megiddo andDharmendra S. Modha

Presented by Gim Tcaesvk

Page 2: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

Cache

Cache

Auxiliary memory

Cache is expensive.

The replacement policy is the only algorithm of interest.

Page 3: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

Cache management problem

Maximize the hit rate.

Minimize the overhead.ComputationSpace

Page 4: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

Belady’s MIN

Replaces the furthest referenced page.

Optimum for every case.Provides upper bound of hit ratio.

But,Who knows the future?

Page 5: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

LRU (Least Recently Used)

Replaces the least recently used page.Optimum policy for SDD (Stack Depth Distributi

on).Captures recency but not frequency.

0 1 2 3 2 3 2 1

0

1

2

1

2

3

3

2

2

3

3

2

3

2

1

Page 6: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

LFU (Least Frequently Used)

Replaces the least frequently used page.Optimum policy for IRM (Independent Referenc

e Model).Captures frequency but not recency.

0 0 1 1 2 3

0

0

1

0

1

23

0

Page 7: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

Drawbacks of LFU

Logarithmic complexity in cache size

High frequently used page is hardly to paged out.Even if it is no longer useful.

Page 8: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

LRU-2

Replaces the least 2nd recently used page.

Optimum online policy which knows at most 2 most recent reference for IRM.

Page 9: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

Limitations of LRU-2

Logarithmic complexityDue to priority queue

Tunable parameter,CIP (Correlated Information Period)

2(2,4)

1(1,3)

0(-∞,0)

Page 10: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

2Q (modified LRU-2)

Uses simple LRU list instead of the priority queue.

Two parameter, Kin and Kout

Kin=Correlated Information PeriodKout=Retained Information Period

Page 11: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

LIRS (Low Inter-reference Recency Set)

Maintains 2 LRU stacks of different size.Llirs maintains LRU page at least twice recent

ly seen.Lhirs maintains LRU page only once recently s

een.

Works well for IRM, but not for SDD.

Page 12: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

FBR (Frequency-Base Replacement)

Divide LRU list into 3 sections;New

Reference count in new section is not incremented.

MiddleOld

Replaces page in old section with smallest reference count.

Page 13: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

LRFU (Least Recently/Frequently Used)

1,

0,

otherwise 2

t;at time referenced is if 21

LRU

LFULRFU

xC

xxCxC

Exponential smoothing. λ is hard to tune.

Page 14: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

MQ (Multi-Queue)

Uses m LRU queues Q0, Q1, … Qm-1

Qi contains page that have been seen [2i,2i+1) times recently.

Page 15: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

Introducing a Class of Replacement Policies

Page 16: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

DBL(2c): DouBLe

Maintains 2 variable-sized lists.Holds 2c pages.

cL

cL

cLL

20

0

20

2

1

21

Page 17: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

DBL(2c) flow

21 LLxt 2in LMRUxt

cL 1

1in LMRUxt

True

True

False

False

out in 1LLRU cLLLLRU 2 ifout in 212

Most recent c page will always be contained.

Page 18: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

: A new class of policy c

ii BMRUTLRU in n recent tha more is in

222 BTL

111 BTL

cTTcLL

BBcLL

2121

2121

Page 19: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

FRCp(Fixed Replacement Cache)

FRCp(c) is tuned

We define a parameter p such that.0≤p≤c.

cTT

pcT

pT

cFRCcFRC

cFRC

cFRC

pp

p

p

21

2

1

ccTT

21

Page 20: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

FRCp(c) flow

2Tin MRUxt 21 TTxt

Replace

21 BBxt

21 LLxt

Delete

1Tin MRUxt

1Lin LRU

Replace

True

Delete

cLL

LRU

2 if

Bin

21

2

False

21

21

BB

TTxt

cL 1

Page 21: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

ARC (Adaptive Replacement Cache)

US Patent 20040098541Assignee Name: IBM Corp.

Page 22: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

ARC (Adaptive RC)

Adaptation parameter p∈[0,c]For a given (fixed) value of p,

Exactly same as FRCp.But it learns!

ARC continuously adapts and tunes p.

Page 23: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

Learning

We should

2

1

1

21

2

1

2

1

2

1

,1max,,1max

in hit on increase toby decrease

increase

B

B

B

B

B

B

T

Tp

Page 24: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

ARC flow

2Tin MRUxt 21 TTxt

Replace

21 LLxt

Delete

1Tin MRUxt

1Lin LRU

Replace

True

Delete

cLL

LRU

2 if

Bin

21

2

False

22

1

11

2

if ,1max

if ,1max

BxB

Bp

BxB

Bp

p

21 BBxt

cL 1

21

21

BB

TTxt

Page 25: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

Scan-Resistant

Long sequence of 1-time-only reads will pass through L1.

Less hits will be encountered in B1 compared to B2.

If hit in B1, T2 will grow by learning.

Page 26: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

ARC example

0

0

1

0

1

00

2

2

1

11

0

3

2

3

4T1

B1

B2T2

p=2

23

4

2

01

25

4

5

p=3

3

0

p=2

2

3

0

2

6

45

3

6

7

56

4

7

0

1

Page 27: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

Experiment

Various traces used in this paper.

Page 28: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

Experiment: Hit ratio of OLTP

ARCOutperforms online parameter algorithms.Performs as well as offline parameter

algorithms.

Page 29: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

Experiment: Hit ratio (cont.)

MQ outperforms LRU, while ARC outperforms all.

Page 30: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

Experiment: Hit ratio (cont.)

Comparison for various workloads shows ARC outperforms.

Page 31: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

Experiment: Cache size of P1

ARC performs always better than LRU.

Page 32: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

Experiment: parameter p

“Dances to the tune being played by workload.”

Page 33: ARC: A self-tuning, low overhead Replacement Cache Nimrod Megiddo and Dharmendra S. Modha Presented by Gim Tcaesvk

Summary

ARC Is online and self-tuning.

Is robust for a wider range of workloads.

Has less overhead Is scan-resistant.

Outperforms LRU.