Scope/Description
- This article details the process of adding a L2ARC or cache drive to your zpool. L2ARC can be used to improve performance of random read loads on the system.
L2ARC
- In a ZFS system a caching technique called ARC caches as much of your dataset in RAM as possible. This allows frequently data to accessed very quickly, much faster than having to go the backing HDD array. It follows that more RAM means more ARC space which in turn means more data can be cached. The maximum space ARC will occupy can be changed but typically it uses up to 7/8 of your RAM, however will release memory back to system as other applications require it. So if you had 128GB of RAM in your system and your total dataset size was 1TB, 11.2% of all your data will reside in the ARC resulting in significantly faster access times.
- The ARC has a very intelligent algorithm to manage the cache to ensure that data present is data you actually want cached. You don’t want data you never actually use in your cache as it would be a waste of resources.
- Although this algorithm is very effective, as your data-set increases the % of your data that can be stored in the cache gets less and less, and the cache becomes less effective.
- This is where the L2ARC comes in, it is an extension of the ARC cache hence the name Level 2 ARC. Using fast disks such as SSDs the cache size can increase dramatically when the option of adding more RAM becomes either physically or economically impossible.
- Now unlike the ARC cache, the L2ARC does not populate itself with data as soon as you set it up, its loads itself with data as it gets ejected out of the ARC. Therefore it can take some time to fully populate your L2ARC and see the added performance benefit.
Prerequisites
- An unused SSD to use as L2ARC
- The sdX name of the SSD added to the unit
Steps
Houston UI
- Go to the ZFS + File Sharing tab, then “Status” of the pool.
- Add a vdev
- Select Virtual Device as Cache, then select the disk you want to add, then click Add.
Command Line
- To add a single SSD as a L2ARC run this command.
zpool add pool cache sdX
- For adding multiple drives.
zpool add pool cache sdX sdX sdX sdX
Verification
- In the Status tab of the zpool you should now see the cache added.
- After adding the L2ARC run this command and confirm it was added to the zpool.
zpool status pool
Troubleshooting
Views: 11751