Buffer Management Policy TANG Xian
Outline Introduction Buffer management policy on disk Buffer management policy on flash Conclusion
Introduction Buffer management is very important for the overall performance of the DBMS A. Leventhal. Flash Storage Memory. Communications of ACM, July 2008
Introduction Magnetic disk Flash The same speed of Read/Write Rewrite in place Mechanical moving parts Buffer hit ratio Flash Asymmetric speed of Read/Write No overwrite No mechanics delay Try to reduce the number of write/erase at the expense of the read operations
Outline Introduction Buffer management policy on disk Buffer management policy on flash Conclusion
LRU Replaces the least recently used page Captures recency but not frequency 1 2 3 2 3 2 1 3 3 2 2 2 1 2 2 3 1 3 2 1 3 Richard L. Mattson, Jan Gecsei, Donald R. Slutz, Irving L. Traiger: Evaluation Techniques for Storage Hierarchies. IBM Systems Journal (IBMSJ) 9(2):78-117 (1970)
LFU Replaces the least frequently used page Captures frequency but not recency 3 1 1 2 3 1 2 3 3 1 2 1 3 2 Alfred V. Aho, Peter J. Denning, Jeffrey D. Ullman: Principles of Optimal Page Replacement. J. ACM (JACM) 18(1):80-93 (1971)
FBR 0, 7, 11 0, 7, 11 0, 7, 11 0, 7, 11 New section middle section Page number New flag count Old 0, 7, 11 0, 7, 11 0, 7, 11 0, 7, 11 2 T 1 F T T 1 F 1 T F 5 T 1 F 7 F 1 F 3 F 1 8 F 1 6 F 1 T 4 F 1 T 9 F 2 T MRU 2 LRU New section middle section old section New boundary old boundary 11 T 1 F 2 T 1 F 6 5 7 3 8 F 4 F 1 T 9 F 2 T New boundary old boundary MRU LRU New section middle section old section T John T. Robinson, Murthy V. Devarakonda: Data Cache Management Using Frequency-Based Replacement. SIGMETRICS 1990:134-142
2Q 8, 16, 2, 19, 3 8, 16, 2, 19, 3 8, 16, 2, 19, 3 Ain: FIFO Aout: FIFO Am: LRU head tail 5 10 2 15 1 18 Aout 16 13 8 5 7 6 4 3 11 9 Ain Am 25% Theodore Johnson, Dennis Shasha: 2Q: A Low Overhead High Performance Buffer Management Replacement Algorithm. VLDB 1994:439-450
2Q 8, 16, 2, 19, 3 Ain: FIFO Aout: FIFO Am: LRU head tail 8 5 10 2 15 13 8 7 6 4 3 11 9 Ain Am 25% Theodore Johnson, Dennis Shasha: 2Q: A Low Overhead High Performance Buffer Management Replacement Algorithm. VLDB 1994:439-450
2Q Ain: FIFO 8, 16, 2, 19, 3 Aout: FIFO Am: LRU head tail 8 5 10 15 1 13 16 7 6 4 3 11 9 2 19 Ain Am 25% Theodore Johnson, Dennis Shasha: 2Q: A Low Overhead High Performance Buffer Management Replacement Algorithm. VLDB 1994:439-450
2Q Ain: FIFO Aout: FIFO 8, 16, 2, 19, 3 Am: LRU head tail 8 5 10 15 1 13 7 6 4 2 3 11 9 Ain Am 25% Theodore Johnson, Dennis Shasha: 2Q: A Low Overhead High Performance Buffer Management Replacement Algorithm. VLDB 1994:439-450
(no algorithm operations) CLOCK (1) All the resident pages are placed around a circular list, like a clock; Each page is associated with a reference bit, indicating if the page has been accessed. 1 1 1 1 CLOCK hand 1 On a HIT Set Reference bit to 1 (no algorithm operations) 1 1 1 F. J. Corbato. “A Paging Experiment with the Multics System,” Project MAC Memo MAC-M-384, Mass. Inst. Of Tech., 1968 1
On a sequence of two MISSes CLOCK (2) Starts from the currently pointed page, and evicts the page if it is”`0”; Move the clock hand until reach a “0” page; Give “1” page a second chance, and reset its “1” to “0” 1 1 1 On a sequence of two MISSes 1 CLOCK hand On a miss access, CLOCK turns the clock hand, evict the first “0” page; CLOCK inserts the missed page at the head, initialize its reference bit to 0. If the ref-bit of page pointed by the hand is “1”, CLOCK gives it a second chance without replacing it, And reset its “1” to “0” and continue to look for a page with its bit of “0” CLOCK simulates LRU replacement very well, and its hit ratios are very close to LRU. 1 1 1 1 F. J. Corbato. “A Paging Experiment with the Multics System,” Project MAC Memo MAC-M-384, Mass. Inst. Of Tech., 1968 1
Outline Introduction Buffer management policy on disk Buffer management policy on flash Conclusion
CFLRU Clean-first LRU 9 1 D 9 C 2 C 3 D 4 D 5 C 6 D 7 C 8 D Working region Clean-first region Seon-Yeong Park, Dawoon Jung, Jeong-Uk Kang, Jinsoo Kim, Joonwon Lee: CFLRU: a replacement algorithm for flash memory. CASES 2006:234-241
CFLRU Clean-first LRU 9 9 C C 1 D 2 C 3 D 4 D 5 C 6 D 8 D 9 C C 1 D 2 C 3 D 4 D 5 C 6 D 8 D Working region Clean-first region Seon-Yeong Park, Dawoon Jung, Jeong-Uk Kang, Jinsoo Kim, Joonwon Lee: CFLRU: a replacement algorithm for flash memory. CASES 2006:234-241
CFLRU Clean-first LRU 9 7 C 9 C 1 D 2 C 3 D 4 D 6 D 8 D Working region 7 C 9 C 1 D 2 C 3 D 4 D 6 D 8 D Working region Clean-first region Seon-Yeong Park, Dawoon Jung, Jeong-Uk Kang, Jinsoo Kim, Joonwon Lee: CFLRU: a replacement algorithm for flash memory. CASES 2006:234-241
CFLRU/C, CFLRU/E, DL-CFLRU/E p7 , p5 , p8 , p6 CFLRU/Count: w.clean LRU w.dirty LFU p7 , p5 , + LFU (p8, p6) CFLRU/Erase: w.dirty block with the lowest erase count p7 , p5 , + block erase count (p8, p6) DL-CFLRU/E (Double List CFLRU/E): buffer.clean LRU w.dirty block with the lowest erase count p7, p5, p4, p2, + block erase count (p8, p6) Yun-Seok Yoo, Hyejeong Lee, Yeonseung Ryu, Hyokyung Bahn: Page Replacement Algorithms for NAND Flash Memory Storages. ICCSA 2007:201-212
FAB Portable Media Player (PMP) A block-level LRU policy Reduce GC cost LRU Head Tail LRU Head Tail Heeseung Jo, Jeong-Uk Kang, Seon-Yeong Park, Jin-Soo Kim, and Joonwon Lee. FAB: flash-aware buffer management policy for portable media players. Consumer Electronics, IEEE Transactions on, 52(2):485-493, 2006
BPLRU Block-level LRU Page padding LRU Head Tail Hyojun Kim and Seongjun Ahn. BPLRU: A Buffer Management Scheme for Improving Random Writes in Flash Storage, FAST 2008
Outline Introduction Buffer management policy on disk Buffer management policy on flash Conclusion
Conclusion 6 buffer management policies on disk Hit ratio Recency frequency 4 buffer management policies on flash Reduce write operation Page-level Block-level
Q & A Thanks!