Is it worth adding NAS and SSD cache? I tested it with 256G Samsung for a week
My Feiniu NAS has been running for half a year, and it has a 4T Western Digital blue disk inside. I recently wanted to transfer a few movies to my computer, but the speed has been hovering around 120MB/s. It takes seven or eight minutes to copy a 40G file. A friend said that adding an SSD as a cache can speed up the process, so I thought about it.: Random reading and writing of mechanical disks is a flaw, and caching can indeed make up for this shortcoming. I just did what I said. I bought a 256G Samsung 970 EVO Plus, installed it and tested it for a week. The conclusion is - some scenes are ridiculously fast, and some scenes have no feeling at all.
Make it clear first: Caching is not a master key
Many people think that with the addition of SSD cache, NAS will become solid-state speed. Not so. The caching mechanism is "read ahead + write buffering"": The system finds that you are reading file A, so it loads files B and C into the cache. Next time you happen to need them, just give them to them directly. The same goes for writing, first write to the SSD, and then slowly flash to the mechanical disk.
My 970 EVO Plus has a 256G, SATA3 interface, and a theoretical sequential read and write speed of 550MB/s. After installing it, I first configured it in the "Storage-Cache" of Feiniu backend.: Select "Accelerated Read and Write" mode to allocate 2G to the read cache and 2G to the write cache. Why is only 4G allocated? Because the 256G disk is used for caching, the system will automatically use the entire disk as a cache pool. If the allocation is too large, it will occupy resources.
There is a pit here: In Feiniu's cache configuration, the "maximum read-ahead size" defaults to 128K, and I haven't touched it. Later, I found that this value was too small. After changing it to 512K, the speed of sequential reading was significantly improved. This parameter is called "Read-Ahead" in Synology. Feiniu uses the same set of kernel logic, but the interface translation is different.
Reading and writing test: The gap between the three types of documents is bigger than I thought.
I tested three types of files: Movies (4K Blu-ray original disc), photos (JPG batch copy), virtual machine image (single file 20G). The results are as follows:
| File type | No cache speed | After adding cache | Increase multiplier |
|---|---|---|---|
| 4K Blu-ray original disc (50G single file) | 118MB/s | 142MB/s | 1.2 times |
| JPG photo batch (1000 photos/5G) | 45MB/s | 280MB/s | 6.2 times |
| Virtual machine image (20G single file) | 125MB/s | 138MB/s | 1.1 times |
The gap is very big. Why? Movies and virtual machine images both read and write large files sequentially. The sequential speed of the mechanical disk is not low (about 150MB/s), and the cache cannot help. Photos are batch operations of small files, and random reading and writing are the Achilles heel of mechanical disks. SSD caching directly makes up for this shortcoming.
I ran Feiniu's built-in speed test tool several times. After the read cache hit, the random 4K IOPS increased from 85 to 2200. This data can be seen in the background log, the path is "Storage-Performance Monitoring". If you mainly use it to store photos and run Docker containers, this improvement is real.
Docker container: The true power of caching
Let me explain here: If your NAS runs a Docker container, the value of caching is completely different. I talked about it in my previous article Pitfalls to log in again after Tailscale loses power , that’s because the container database is read too frequently and cannot be handled without cache. After adding cache, such problems will be significantly reduced.
I have two containers running on my NAS: A Jellyfin (media server), a Pi-hole (DNS filtering). When there was no caching before, when Jellyfin transcoded a 1080P video, the CPU usage could reach 85%, and frames often dropped. After adding cache, the CPU usage dropped to 62% for transcoding at the same level.
The reason is that when Jellyfin reads video files, it will frequently do random reading of small fragments (for real-time transcoding). All these requests fall into the SSD cache, and the mechanical disk is almost not involved. I ran an experiment before: Jellyfin's database was also migrated to the cache volume, and the query speed dropped from 120ms to 18ms.
Pi-hole is more obvious. It handles dozens of DNS queries per second, reading the database each time. Before adding cache, I measured that its response time would occasionally reach over 50ms. After adding cache, it is stable within 3ms.
How to choose capacity: Is 256G enough or too tight?
I wanted to buy 500G at first, but then I made a calculation: Caching mainly deals with random reading and writing and metadata pre-reading, not long-term storage. For a 256G disk, if the system automatically manages the cache space, the actual available capacity will be around 180G (space must be left for logs and temporary files). There are 30,000 photos stored on my NAS. Metadata pre-reading takes up about 12G, and the container database takes up 8G. The remaining space is enough for write buffering.
But if what you want to do is "use a cache disk for a virtual machine", 256G is not enough. I tried throwing a 4G virtual machine image into it for caching, but the cache hit rate was only 35%. Because the random reading and writing of the virtual machine disk is too intensive, the cache often cannot be loaded. In this case, either use 500G, or simply put the entire virtual machine on the SSD (no caching, just storage).
The logic of capacity selection is very clear: If it is mainly photos + containers, 256G is enough ; If it is a virtual machine or a large database, 500G starts ; If you only use NAS to store movies occasionally, adding cache is not as cost-effective as RAID with multiple mechanical disks. I wrote before NAS does not turn on itself after receiving a call In that article, I mentioned the protection mechanism of RAID in power outage scenarios. Although the cache disk does not participate in RAID, you must also pay attention to its stability.
The pits that have been stepped on: The cache disk is offline and the NAS is almost bricked
On the third day of this week, the NAS alarmed in the middle of the night.: The cache disk is offline. I got up and took a look. The LED light of the 970 EVO Plus stopped flashing, and the system prompted "Device not responding." After restarting, it returned to normal, but a line was left in the log.: ata1.00: exception Emask 0x10 SAct 0x0 SErr 0x100 action 0x6 frozen .
After checking for a long time, I found that the SATA cable had poor contact. I plugged it in again and ran the hard drive test for 48 hours (there is "Storage-Diagnosis" in the Feiniu backend), and it didn't crash again. But I learned from this: Although the cache disk does not need to store data, once it hangs, the entire storage pool may enter maintenance mode, and the NAS will restart to the rescue interface. Therefore, the SATA cable of the cache disk should be plugged in tightly. It is best to use a short SATA cable (to reduce shaking). The USB to SATA solution for the hard disk box is not recommended.
In addition, there is no "hot plug protection" in Feiniu's cache configuration. If you remove the cache disk and restart it, the system will not automatically ignore it, but will report an error. If you want to change the disk or upgrade, you must first uninstall the cache at the front desk and then physically cut off the power.
in conclusion: Three types of people, three suggestions
If you mainly use it to store photos, run Docker containers, and run media services such as Jellyfin/Emby, a 256G SSD cache is absolutely worth it. Photo batch operations are 6 times faster, and container response is dozens of times faster. These improvements are real. Over the course of a week, I changed from "waiting ten minutes" to "waiting one minute" for uploading photos. The difference in experience is huge.
If you only store movies and backup virtual machine images, adding caching is not cost-effective. Large files are read and written sequentially. The mechanical disk is not slow in nature, and the cache cannot help. In this case, it is better to buy more mechanical disks RAID, giving priority to capacity.
If you want to make a virtual machine cache disk or database cache, 256G is not enough. Start with 500G, or simply put the entire virtual machine on SSD. But pay attention to the lifespan of SSD: The random write density of the virtual machine disk is extremely high. The official lifespan of the 256G 970 EVO Plus is 150TBW. If your virtual machine writes 200G every day, it will be worn out in half a year.
My final configuration is: A 4T Western Digital blue disk is used as a storage pool, a 256G Samsung 970 EVO Plus is used as a cache, and the system automatically manages it. After a week, photos are transferred quickly, the container is not stuck, and the NAS does not alarm. It is worth it. If you want to ask me about the specific model, 970 EVO Plus is an old model with SATA3 interface, but now 256G only costs 220 yuan, which is the most cost-effective. Don't buy the PCIe one. Feiniu motherboard doesn't have an M.2 NVMe slot, so you won't be able to use it if you buy one.
