
In short, the L2ARC is continually fed with blocks that are near eviction from ARC. Instead we feed the L2ARC with blocks when they get near the bottom, making sure to stay ahead of eviction.īrendan Gregg wrote a 2008 blog post-and comment block in zfs/arc.c-which illustrates the L2ARC feed mechanism well: * head -> tail When the ARC is near full, and we are evicting blocks, we cannot afford to wait while we write data to the L2ARC, as that will block forward progress reading in the new data that an application actually wants right now. How the L2ARC receives dataĪnother common misconception about the L2ARC is that it’s fed by ARC cache evictions. The hottest blocks always stay in ARC, and the L2ARC just catches some of the marginal blocks. This is expected, not a bug-L2ARC is a simpler, cheaper way of caching more data than the ARC can fit. This allows for extremely efficient write operations, at the expense of hit ratios.Ī final note before we move on-if it’s not already clear, the L2ARC will very rarely have a hit ratio as high as the ARC’s. The L2ARC is actually a relatively simple ring buffer-first in, last out. Now that we understand both common LRU caches and the ARC reasonably well, we can talk about the L2ARC-which is neither ARC nor LRU cache. A block all the way at the “bottom” of the cache gets evicted the next time a new block is added to the “top.” Each time a new block is added to the cache, all blocks below it are pushed one block further toward the “bottom”. In an LRU cache, each time a block is read it goes to the “top” of the cache, whether the block was already cached or not. These are all LRU cache, or Least Recently Used.

#Openzfs vs maczfs windows
This increases ARC hit ratios, and decreases “cache thrash,” by comparison with more naive caching algorithms.Ĭonventional filesystems-including but not limited to FreeBSD UFS, Linux ext and xfs, and Windows NTFS-use the operating system’s kernel page cache facility as a filesystem read cache. A block which has recently been evicted from ARC-but then had to be read right back into it again-will similarly be difficult to displace. ARC stands for Adaptive Replacement Cache, a complex caching algorithm that tracks both the blocks in cache, and blocks recently evicted from cache, to figure out which are the “hottest” and therefore should be the most difficult to displace.Ī block which is frequently read from the ARC will be difficult to displace simply because new data is read. The first thing to know about the “L2ARC” is the most surprising-it’s not an ARC at all. Today we’re going to talk about one of the well-known support vdev classes under OpenZFS: the CACHE vdev, better (and rather misleadingly) known as L2ARC. Subscribe to our article seriesto find out more about the secrets of OpenZFS
#Openzfs vs maczfs series
This is part of our article series published as “OpenZFS in Depth”.
