FreeNAS に SSD を搭載する

近年のFreeNAS及びTrueNASは、ブートデバイス(システムデバイス)用にSSDを採用することが推奨されています

TrueNAS 12.0 のハードウェア要件

FreeNASハードウェアガイド

また、プール自体をフラッシュストレージで構成するのは、IOPSの面からも、容量と予算の折り合いさえつけば選択肢に入ってきました。

これらのフツーに従来ではUSBメモリやハードディスクを使用していた部分をSSDにする以外で、SSDを使う方法として FreeNAS を使い始めた方が気になる、
ログ(ZIL)と二次キャッシュ(L2ARC)としてSSDを搭載するということについては下記の通りです。


文献からの結論としては、
・とにかくまずは搭載できる限りメモリを増設する
・NFSアクセスで同時書き込みのパフォーマンスを向上したい場合のみ、ZILとして搭載メモリの半分までの容量のSSDを追加する方法がある
・L2ARCとして搭載する場合、メモリ64GB未満の環境では使用するべきではなく、それ以上のメモリを搭載している場合はメモリの5倍までの容量のSSDを追加する方法がある
ということになるようです。無闇に搭載してもパフォーマンスの向上には貢献しないようです。それなら
・SSDのみで構成されたPoolを作成して、パフォーマンスが要求される共有フォルダはそちらを利用する
のがいいでしょうか。
FreeNAS の ZFS Pool にSSDを搭載してパフォーマンスを上げる手法があります。

1つめはNFSによる同時書き込みの際にパフォーマンスを向上させるためのLog(ZIL)と、もう1つはメモリキャッシュのARCだけでは足りないランダムアクセスがある場合のキャッシュとなるCache(L2ARC)。Log(ZIL)はNFS書き込みの際にしか実質的に効果がないと書かれているので、WindowsクライアントでCIFSやiSCSIを利用している場合は考慮する必要はなく、Cache(L2ARC)は最大限のメモリを積んだ場合に、そのメモリでキャッシュできない量のランダムアクセス時にキャッシュとして作動するらしいので、ちょっとやそっとの環境では、できるだけメモリを搭載する、で十分と思われます。

FreeNASそのものではないですし、日付が古いですが、ftp.jaist.ac.jpにおけるZFSのARCとL2ARCのキャッシュのヒット率についての記述が下記に見られます。

ZFSにはメモリキャッシュのARCと、SSDによるキャッシュのL2ARCがあります。メモリは64GBあり、そのうち40GBほどがARCに使われていて90%強ヒットします。L2ARCは320GBで40%ほどヒットします。つまり94%はキャッシュでひろえます。
ftp-adminの憂鬱: RAID-Zは遅いよ

以下、FreeNASのDocumentの当該部分を抜粋して超訳してみました。


8.1.1.3. Extending a ZFS Volume

5台以上のディスクがあって、ZFSを使っているならば、最高のパフォーマンスとスケーラビリティを発揮するように使用するディスクの台数を検討して下さい。
推薦されるディスク・グループ・サイズの概要ならびにログとキャッシュ・デバイスに関する詳細な情報は、ZFS Primerで見ることができます。

If you have more than five disks and are using ZFS, consider the number of disks to use for best performance and scalability. An overview of the recommended disk group sizes as well as more information about log and cache devices can be found in the ZFS Primer.

ZFS Primer

Log (ZIL)
データベースサーバーからや、ESXi越しのNFSへのアクセスの場合などに発生する同時書き込みに対するパフォーマンスを向上します。CIFS AFP iSCSIなどには効果がありません。これらのプロトコルは同時書き込みは滅多に使用しないからです。ZILを構成するには高速でキャパシタ付きのメモリを搭載したSSDを使用することが推奨されます。NFS書き込みのパフォーマンスを向上させるためにはシステムのRAMの半分までの容量のSSDを使用できます。ZFSv28以降のpoolでは、ZILをミラーする必要はありません。ZILを構成するデバイスに障害が発生した場合は、書き込まれなかったデータのみ(通常最後の数秒程度)失われることとなります。ZILに使用するデバイスは他の用途と兼用できません。


ZFS provides a write cache in RAM as well as a ZFS Intent Log (ZIL). The ZIL is a temporary storage area for synchronous writes until they are written asynchronously to the ZFS pool. If the system has many synchronous writes where the integrity of the write matters, such as from a database server or when using NFS over ESXi, performance can be increased by adding a dedicated log device, or slog, using Volume Manager. More detailed explanations can be found in this forum post and in this blog post. A dedicated log device will have no affect on CIFS, AFP, or iSCSI as these protocols rarely use synchronous writes. When creating a dedicated log device, it is recommended to use a fast SSD with a supercapacitor or a bank of capacitors that can handle writing the contents of the SSD’s RAM to the SSD. The zilstat utility can be run from Shell to help determine if the system would benefit from a dedicated ZIL device. See this website for usage information. If you decide to create a dedicated log device to speed up NFS writes, the SSD can be half the size of system RAM as anything larger than that is unused capacity. The log device does not need to be mirrored on a pool running ZFSv28 or feature flags as the system will revert to using the ZIL if the log device fails and only the data in the device which had not been written to the pool will be lost (typically the last few seconds of writes). You can replace the lost log device in the View Volumes ‣ Volume Statusscreen. Note that a dedicated log device can not be shared between ZFS pools and that the same device cannot hold both a log and a cache device.

Cache (L2ARC)
ZFSはランダム読み出しのパフォーマンスを向上させるために、SSDデバイスを搭載することができます。ですが、十分な容量のRAMを搭載したシステムの場合にそれ以上のパフォーマンスを提供するものです。(一次キャッシュの)ARCのための十分なRAMを搭載していないのであれば、パフォーマンスが向上しないどころか、パフォーマンスの低下や安定性の低下を招きます。RAMは常にディスクより高速なので、L2ARCデバイスを考慮する前にまずは、最大限のRAMの増設を検討すべきです。たくさんのランダム読み取りをするアプケーションを利用していて、そのデータ量がL2ARCのサイズにフィットするだけの小ささであるなら、L2ARCによってパフォーマンスを向上することができるでしょう。SSDキャッシュデバイスが効果を発揮するのは、アクティブなデータのサイズがシステムのRAMよりも大きく、SSDの容量よりある程度小さなパーセンテージの場合になります。一般的な経験則として、64GB未満のRAMしか搭載していないシステムには搭載されるべきではなく、L2ARCのサイズは搭載しているRAMの5倍を超えないこと。いくつかのケースではSSDから構成されたアクティブなデータのためのPoolとHDDから構成されたたまに使用されるデータのためのPoolの二つにした方がより効果的なことがあるでしょう。既存のL2ARCに、もうひとつのデバイスを追加してstripe構成にすることで容量を増やすことができます。L2ARCは起動時に再作成されるので、GUIでは常にstripeとして構成します。L2ARCを構成するデバイスに障害が発生した場合でも、poolの健全性は損なわれません。ただし、環境によっては読み出しパフォーマンスに大きな影響が出ることがあるでしょう。L2ARCデバイスは複数のZFS pool間で共用することはできません。


ZFS provides a read cache in RAM, known as the ARC, to reduce read latency. FreeNAS® adds ARC stats to top(1) and includes thearc_summary.py and arcstat.py tools for monitoring the efficiency of the ARC. If an SSD is dedicated as a cache device, it is known as an L2ARC and ZFS uses it to store more reads which can increase random read performance. However, adding an L2ARC is not a substitute for insufficient RAM as L2ARC needs RAM in order to function. If you do not have enough RAM for a good sized ARC, you will not be increasing performance, and in most cases you will actually hurt performance and could potentially cause system instability. RAM is always faster than disks, so always add as much RAM as possible before determining if the system would benefit from a L2ARC device. If you have a lot of applications that do large amounts of random reads, on a dataset small enough to fit into the L2ARC, read performance may be increased by adding a dedicated cache device using Volume Manager. SSD cache devices only help if your active data is larger than system RAM, but small enough that a significant percentage of it will fit on the SSD. As a general rule of thumb, an L2ARC should not be added to a system with less than 64 GB of RAM and the size of an L2ARC should not exceed 5x the amount of RAM. In some cases, it may be more efficient to have two separate pools: one on SSDs for active data and another on hard drives for rarely used content. After adding an L2ARC, monitor its effectiveness using tools such as arcstat. If you need to increase the size of an existing L2ARC, you can stripe another cache device using Volume Manager. The GUI will always stripe L2ARC, not mirror it, as the contents of L2ARC are recreated at boot. Losing an L2ARC device will not affect the integrity of the pool, but may have an impact on read performance, depending upon the workload and the ratio of dataset size to cache size. Note that a dedicated L2ARC device can not be shared between ZFS pools.

文献からの結論としては、

とにかくまずは搭載できる限りメモリを増設する

NFSアクセスで同時書き込みのパフォーマンスを向上したい場合のみ、
ZILとして搭載メモリの半分までの容量のSSDを追加する方法がある

L2ARCとして搭載する場合、
メモリ64GB未満の環境では使用するべきではなく、
それ以上のメモリを搭載している場合はメモリの5倍までの容量のSSDを追加する方法がある

ということになるようです。

MicroServerの場合はメモリが16GBしか搭載できないので、最大実装でもL2ARCを搭載する意味はなく、クライアントがWindowsの場合はZILも効果がない(CIFSかiSCSIでのアクセスだと思うので)、ということになりますね。
それに家庭などの利用では、メモリキャッシュ(ARC)では足りないようなアクセスがあるのはあまり想像できませんね。

上記の文献によると、
64GBのメモリを搭載することができるシステムで、64GBのメモリを搭載している場合は、
L2ARC用のSSDは、320GBまで、(L2ARCの意味がでるのは、64GB超~320GBまでのキャッシュ分)
ZIL用のSSDは、32GBまで、ということになりますね。

L2ARCであろうとZILであろうと、効果のないSSDへのアクセス自体が無駄なので、やはり、メモリ第一で間違いないと思っています。
FreeNAS として利用している場合は、ディスクのアクセス速度がボトルネックではないと思っています。


実際の構成方法について

使用するSSDを接続してFreeNASを起動したら、
Storage - Volume Manager
Volume to extend で
既存のボリュームを選択し、
ボタンを右にスライドして追加するドライブ数を選ぶ。
左のプルダウンで、
Log (ZIL) や Cache (L2ARC)
を選んで
Extend Volume

しばらく待つと追加される。


また、これらのデバイスは、
ボリュームを選択して、
Volume Status
から、
cache
とかなっているドライブを選択して
Remove
で取り外すこともできますので、
上記の文献が信じられない人は試してみてもいいでしょう。

About

2015年03月01日 19:52に投稿されたエントリーのページです。

ひとつ前の投稿は「Google Talk 終了」です。

次の投稿は「KONO式ドリッパー」です。

他にも多くのエントリーがあります。メインページアーカイブページも見てください。

Powered by
Movable Type 3.35