读写缓存
ZFS里面其实是没有真正意义的写缓存,ZFS的缓存有2种
ARC:把内存作为缓存
L2ARC:SSD可以作为二级读缓存
ZIL:写日志缓存,默认是用内存,可以用SSD作为ZIL,但是SSD坏了可能会数据丢失 #測試過會壞
官方文档中对于ZIL缓存的解释:
ZFS provides a write cache in RAM as well as a ZFS Intent Log (ZIL). The ZIL is a storage area that temporarily holds synchronous writes until they are written to the ZFS pool
ZIL是针对同步写入的场景,把同步写入转换为异步写入,使得系统不必卡住等待写入完成,而从而提升系统整体的写入性能。因此只有当你的存储存在大量同步写入的场景时,通过低延迟的SSD等设备来缓存写入场景才能让ZIL明显的提升性能,官方建议在NFS over ESXi以及数据库应用等这类高同步写入场景中来使用ZIL。
在SMB、NFS和iSCSI这类我们常用的家庭NAS共享协议场景下,同步写入的场景是非常非常少的,因此使用ZIL并不能明显提升性能,因此,在家用场景下,官方并不建议我们使用专门的设备来启用ZIL。
官方文档中对于L2ARC缓存的解释:
ZFS provides a read cache in RAM, known as the ARC, which reduces read latency. If an SSD is dedicated as a cache device, it is known as an L2ARC. Additional read data is cached here, which can increase random read performance.
L2ARC does not reduce the need for sufficient RAM. In fact, L2ARC needs RAM to function. If there is not enough RAM for a adequately-sized ARC, adding an L2ARC will not increase performance. Performance actually decreases in most cases, potentially causing system instability. RAM is always faster than disks, so always add as much RAM as possible before considering whether the system can benefit from an L2ARC device.
二级缓存需要依赖更大的内存来发挥作用,根据官方建议,针对小于32G的内存场景下,不推荐开启L2ARC缓存,并且L2ARC的缓存大小一般不能超过内存的10倍。
所以综上所述,能加内存和硬盘才是王道,SSD缓存(家用情况)不用加。