Skip to main content
AmigoFish

I Didn't Know Linux Could Cache NFS Files Locally

From Techno Tim · · 9 min

The player loads from YouTube only when you click. It uses YouTube's privacy-enhanced mode.

If the video does not play, the owner may have turned off embedding. Watch it on YouTube instead.

Watch on YouTube

Not rated yet

Description

Did you know Linux can cache NFS files on a local SSD? I somehow missed this feature, so I decided to try it out.

In this video, I'll show you how to set up FS-Cache, CacheFiles, and cachefilesd on Ubuntu, how caching and eviction work, and how much faster repeated reads can be.

In my testing, reading 155 GiB of files over NFS while filling the local cache took 565 seconds even over 10 gig. Reading those same files again from the SSD cache took just 93 seconds, about 6x faster! I cleared the RAM cache between tests to make sure the improvement came from the local SSD.

Video Notes & Tutorial: https://technotim.com/posts/cache-nfs-files-locally-with-linux-fs-cache-and-cachefiles/

Merch Shop 🛍️: https://l.technotim.com/shop Support me on Patreon: https://www.patreon.com/technotim Sponsor me on GitHub: https://github.com/sponsors/timothystewart6 Subscribe on Twitch: https://www.twitch.tv/technotim Become a YouTube member: https://www.youtube.com/channel/UCOk-gHyjcWZNj3Br4oxwh0A/join Gear Recommendations: https://l.technotim.com/gear Get Help in Our Discord Community: https://l.technotim.com/discord 2nd channel: https://www.youtube.com/@TechnoTimTinkers

(Affiliate links may be included in this description. I may receive a small commission at no cost to you.)

0:00 Why Cache NFS Files Locally? 0:48 How Linux FS-Cache Works 1:21 Setting Up the Linux Client 2:08 Testing a Large File Over NFS 2:58 Creating a 256 GB Local SSD Cache 3:37 Configuring CacheFiles and LRU 4:34 Starting cachefilesd and Enabling Caching 5:08 Testing Cold vs Warm Reads 6:07 Benchmarking the 155 GB of Files 6:59 Results, 565 Seconds vs 93 Seconds 7:35 RAM Cache vs SSD Cache 8:06 Where Else FS-Cache Can Help 8:21 Limitations and Alternatives

Thank you for watching!

Back to Techno Tim · Report a problem