While all page replacement algorithms rely on existence of reference locality to function, a major difference among different replacement algorithms is on how this locality is quantified. LIRS uses reuse distance of a page, or the number of distinct pages accessed between two consecutive references of the page, to quantify locality. Specifically, LIRS uses last and second-to-last references (if any) for this purpose. If a page is accessed for the first time, its reuse distance is infinite. In contrast, LRU uses recency of a page, which is the number of distinctive pages accessed after the reference of the page, to quantify locality. To take into account of up-to-date access history, the implementation of LIRS actually uses the larger of reuse distance and recency of a page as the metric to quantify its locality, denoted as RD-R. Assuming the cache has a capacity of C pages, the LIRS algorithm is to rank recently accessed pages according to their RD-R values and retain the C most highly ranked pages in the cache.
The concepts of reuse distance and recency can be visualized as below, in which T1 and T2 are page B’s second-to-last and last reference times, respectively, and T3 is the current time.
LIRS organizes metadata of cached pages and some uncached pages and conducts its replacement operations described as below, which are also illustrated with an example 3 in the graph.
LIRS has been deployed in MySQL since version 5.1,4 and another reference by link. It is also adopted in Infinispan data grid platform.5 An approximation of LIRS, CLOCK-Pro,6 is adopted in NetBSD.7 LIRS is adopted in Apache Jackrabbit, a Content Repository. An in-memory LIRS cache is developed in the Red Hat JBoss Data Virtualization System. LIRS is used in the H2 Database Engine, which is called a Scan Resistant Cache. Furthermore, LIRS is used in Apache Impala, a data processing with Hadoop.
Jiang, Song; Zhang, Xiaodong (June 2002). "LIRS: an efficient low inter-reference recency set replacement policy to improve buffer cache performance". ACM SIGMETRICS Performance Evaluation Review. 30 (1): 31–42. doi:10.1145/511399.511340. /wiki/Doi_(identifier) ↩
Mattson, R.L.; Gecsei, J.; Slutz, D. R.; Traiger, I. L. (1970). "Evaluation techniques for storage hierarchies". IBM Systems Journal. 9 (2): 78–117. doi:10.1147/sj.92.0078. https://ieeexplore.ieee.org/document/5388318 ↩
Song Jiang; Xiaodong Zhang (2005). "Making LRU Friendly to Weak Locality Workloads: A Novel Replacement Algorithm to Improve Buffer Cache Performance". IEEE Transactions on Computers. 54 (8): 939–952. doi:10.1109/TC.2005.130. S2CID 11539061. https://ieeexplore.ieee.org/document/1453496 ↩
svn commit - mysqldoc@docsrva: r6768 - trunk/ndbapi http://lists.mysql.com/commits/28601 ↩
Infinispan eviction, batching updates and LIRS http://blog.infinispan.org/2010/03/infinispan-eviction-batching-updates.html ↩
Song Jiang, Feng Chen, and Xiaodong Zhang, "CLOCK-Pro: An Effective Improvement of the CLOCK Replacement", in Proceedings of 2005 USENIX Annual Technical Conference (USENIX'05), Anaheim, CA, April, 2005. http://www.cse.ohio-state.edu/hpcs/WWW/HTML/publications/abs05-3.html ↩
FreeBSD/Linux Kernel Cross Reference sys/uvm/uvm_pdpolicy_clockpro.c http://fxr.watson.org/fxr/source/uvm/uvm_pdpolicy_clockpro.c?v=NETBSD ↩