1 / 54

LIRS : An Efficient Replacement Policy to Improve Buffer Cache Performance

LIRS : An Efficient Replacement Policy to Improve Buffer Cache Performance. Song Jiang 1 and Xiaodong Zhang 1,2 1 College of William and Mary 2 National Science Foundation. The Problem of LRU Replacement. Inability to cope with weak access locality.

avi
Download Presentation

LIRS : An Efficient Replacement Policy to Improve Buffer Cache Performance

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LIRS: An Efficient Replacement Policy to Improve Buffer Cache Performance Song Jiang1 and Xiaodong Zhang1,2 1College of William and Mary 2National Science Foundation

  2. The Problem of LRU Replacement Inability to cope with weak access locality • File scanning: one-time accessed blocks are not replaced timely; • Loop-like accesses: blocks to be accessed soonest can be unfortunately replaced; • Accesses with distinct frequencies: Frequently accessed blocks can be unfortunately replaced.

  3. Why does LRU Fail Sometimes? • A recently used block is not necessarily to be used again soon. • Can not deal with working set larger than available cache size

  4. LRU Merits • Simplicity: affordable implementation • Adaptability: responsive to access pattern changes

  5. Our Objectives Significant efforts have been made to improve LRU, but • Case by case; or • High runtime overhead Our objectives: • Address the limits of LRU fundamentally. • Retain the low overhead and adaptability merits of LRU.

  6. Outline • Related Work • The LIRS Algorithm • LIRS Implementation Using LRU Stack • Performance Evaluation • Sensitivity and Overhead Analysis • Conclusions

  7. Related Work • Aided by user-level hints • Detection and adaptation of access regularities • Tracing and utilizing deeper history information

  8. User-level Hints • Application-controlled file caching [Cao et al, USENIX’94] • Application-informed prefetching and caching [Patterson et al, SOSP’96] Rely on users’ understanding of data access patterns

  9. Detection and Adaptation of Regularities • SEQ: sequential access pattern detection [Glass et al, Sigmetrics’97] • EELRU: on-line analysis of aggregate recency distributions of referenced blocks[Smaragdakis et al, Sigmetrics’97] • DEAR: detection of multiple block reference patterns [Choi et al, USENIX’99] • AFC: Application/File-level Characterization [Choi et al, Sigmetrics’00] • UBM: Unified Buffer Management [Kim et al, OSDI’00] Case-by-case oriented approaches

  10. Tracing and Utilizing Access History • LRFU: combine LRU and LFU [Lee et al, Sigmetrics’99] • LRU-K: replacement decision based on the time of the Kth-to-last reference [ O'Neil et al, Sigmod’93] • 2Q: use two queues to quickly remove cold blocks [Johnson et al, VLDB’94] Either high implementation cost, or workload dependent performance

  11. Outline • Related Work • The LIRS Algorithm • LIRS Implementation Using LRU Stack • Performance Evaluation • Sensitivity and Overhead Analysis • Conclusions

  12. 5 3 2 1 Observation of Data Flow in LRU Stack • Blocks are ordered by recency in the LRU stack; • Blocks enter from stack top, and leave from its bottom; A block evicted from the bottom of the stack should have been evicted much earlier ! . . . LRU stack 6

  13. Inter-Reference Recency (IRR) IRR of a block: number of other unique blocks accessed between two consecutive references to the block. Recency: number of other unique blocks accessed from last reference to the current time. R = 2 IRR = 3 1 2 3 4 3 1 5 6 5

  14. Principles of Our Replacement If a block’s IRR is high, its next IRR is likely to be high again. We select the blocks with high IRRs for replacement . Once IRR is out of date, we rely on therecency. LIRS:Low Inter-reference Recency Set Replacement PolicyWe keep the blocks with low IRRs in cache.

  15. Llirs Lhirs Basic LIRS Idea: Keep LIR Blocks in Cache Low IRR (LIR) block and High IRR (HIR) block Block Sets Physical Cache LIR block set (size is Llirs ) Cache size L =Llirs + Lhirs HIR block set

  16. An Example for LIRS Llirs=2, Lhirs=1 LIR block set = {A, B}, HIR block set = {C, D, E}

  17. LIR block set A B A B E C D E Resident blocks HIR block set Mapping to Cache Block Sets Physical Cache Llirs=2 Lhirs=1

  18. Which Block is replaced ? Replace a HIR Block D is referenced at time 10 The resident HIR block (E) is replaced !

  19. How LIR Set is Updated ? Recency of LIR Block Used

  20. After D is Referenced at Time 10 E is replaced, D enters LIR set

  21. If Reference is to C at Time 10 . . . . . . E is replaced, C can not enter LIR set

  22. The Power of LIRS Replacement Capability to cope with weak access locality • File scanning: one-time accessed blocks will be replaced timely; • Loop-like accesses: blocks to be accessed soonest will NOT be replaced; • Accesses with distinct frequencies: Frequently accessed blocks will NOT be replaced.

  23. Outline • Related Work • The LIRS Algorithm • LIRS Implementation Using LRU Stack • Performance Evaluation • Sensitivity and Overhead Analysis • Conclusions

  24. LIRS Efficiency: O(1) IRR HIR (New IRR of the HIR block) Rmax (Maximum Recency of LIR blocks) This efficiency is achieved by our LIRS stack. LRU stack + LIR block with Rmax recency in its bottom ==> LIRS stack.

  25. LIRS stack LRU stack resident block 5 5 LIR block 3 3 2 2 1 HIR block 1 6 6 9 4 Cache size L = 5 8 Llir= 3 Lhir =2 Differences between LRU and LIRS Stacks • Stack size of LRU decided by cache size, and fixed; Stack size of LIRS decided by LIR block with Rmax recncy, and varied. • LRU stack holds only resident blocks; LIRS stack holds any blocks whose recencies are no more than Rmax. • LRU stack does not distinguish “hot” and “cold” blocks in it; LIRS stack distinguishes LIR and HIR blocks in it, and dynamically maintains their statues.

  26. Rmax(Maximum Recency of LIR blocks) IRR HIR (New IRR of the HIR block) How does LIRS Stack Help? LIRS Stack Blocks in the LIRS stack ==> IRR < Rmax Other blocks ==> IRR > Rmax

  27. resident in cache 5 LIR block 3 Cache size L = 5 2 HIR block 1 Llir= 3 Lhir =2 6 9 4 5 8 3 Resident HIR Stack Q LIRS stack S LIRS Operations • Initialization: All the referenced blocks are given an LIR status until LIR block set is full. • We place resident HIR blocks in Stack Q • Upon accessing a LIR block (a hit) • Upon accessing a resident HIR block (a hit) • Upon accessing a non-resident HIR block (a miss)

  28. resident in cache 4 5 5 4 5 LIR block 3 3 8 3 2 2 Cache size L = 5 2 1 1 HIR block 1 6 Llir= 3 Lhir =2 6 6 9 5 9 9 5 5 4 3 3 3 8 8 Q S Q Q S S Access a LIR block (a Hit) Access 4 Access 8 S d

  29. resident in cache 4 3 3 8 4 4 LIR block 8 8 5 5 Cache size L = 5 3 HIR block 2 2 Llir= 3 Lhir =2 1 5 1 5 5 3 5 1 Q Q Q S S S Access a HIR Resident block (a Hit) Access 3 Access 5 S d

  30. resident in cache 3 3 7 LIR block 4 4 5 8 8 Cache size L = 5 HIR block Llir= 3 Lhir =2 7 5 5 1 5 Q Q S S Access a Non-Resident HIR block (a Miss) Access 7

  31. 9 5 3 3 7 7 8 4 4 5 resident in cache 5 7 8 8 5 block number Cache size L = 5 LIR block HIR block 3 4 Llir= 3 Lhir =2 9 8 7 7 9 5 Q Q S S Q S Access a HIR Non-Resident block (a Miss) (Cont) Access 9 Access 5

  32. Outline • Related Work • The LIRS Algorithm • LIRS Implementation Using LRU Stack • Performance Evaluation • Sensitivity and Overhead Analysis • Conclusions

  33. Workload Traces • cpp is a GNU C compiler pre-processor trace • cs is an interactive C source program examination tool trace. • glimpse is a text information retrieval utility trace. • postgres is a trace of join queries among four relations in a relational database system • sprite is from the Sprite network file system • mulit1 is obtained by executing two workloads, cs and cpp, together. • multi2 is obtained by executing three workloads, cs, cpp, and postgres, together.

  34. Representative Access patterns • Looping references: all blocks are accessed repeatedly with a regular interval; • Temporally-clustered references: blocks accessed more recently are the ones more likely to be accessed again soon. • Probabilistic references: each block has a stationary reference probability, and all blocks are accessed independently with the associated probabilities.

  35. Cache Partition • 1%of the cache size is for HIR blocks • 99% of the cache size is for LIR blocks • Performance is not sensitive to a partition.

  36. Looping Pattern: cs (Time-space map)

  37. Looping Pattern: cs (Hit Rates)

  38. Looping Pattern: postgres (Time-space map)

  39. Looping Pattern: postgres (Hit Rates)

  40. Looping Pattern: postgres (Hit Rates)

  41. Probabilistic Pattern: cpp (Time-space map)

  42. Probabilistic Pattern: cpp (Hit Rates)

  43. Temporally-Clustered Pattern: sprite (Time-space map)

  44. Temporally-Clustered Pattern: sprite (Hit Rates)

  45. Mixed Pattern: multi1 (Time-space map)

  46. Mixed Pattern: multi1 (Hit Rates)

  47. Mixed Pattern: multi2 (Time-space map)

  48. Mixed Pattern: multi2 (Hit Rates)

  49. Outline • Related Work • The LIRS Algorithm • LIRS Implementation Using LRU Stack • Performance Evaluation • Sensitivity and Overhead Analysis • Conclusions

  50. Sensitivity to the Change of Lhirs

More Related