Learned Buffer Replacement for Database Systems
Yigui Yuan, Peiquan Jin · 2022
Most current database buffering schemes adopt an empirical design, which cannot adapt to the change of workloads. In this paper, we show how we can use machine learning to help design a new buffer replacement policy for database systems. We name the new policy LBR (Learned Buffer Replacement). The key idea of LBR is to use machine learning models to periodically learn the access pattern from historical requests to make the buffer replacement adaptive to the workload change. Particularly, we present two ways to learn the access pattern. One is a classifier named LBR-c, which can distinguish hot pages from cold ones based on the training on historical requests; the other is a regressor called LBR-r, which can predict the future replacement behavior according to historical accesses. We implement the proposed LBR-c and LBR-r and compare them to a number of existing schemes, including the theoretically optimal Belady's algorithm, three traditional algorithms (LRU, 2Q, and ARC), and LeCaR, which is a recently-proposed adaptive buffer scheme. The results show that our algorithms achieve a higher hit ratio than LRU, ARC, 2Q, and LeCaR. In addition, both LBR-c and LBR-r can adapt to workload changes, which is better than LRU, 2Q, ARC, and LeCaR. Overall, our proposal achieves comparable performance with the optimal buffer replacement algorithm, advancing the state-of-the-art in the well-studied area of buffer management in DBMSs.