====== 15 Ubuntu ZFS zfs_arc_max ====== ARC(Adaptive Replacement Cache)はメモリ上に配置しているZFS用のディスクキャッシュ デフォルトで、実メモリの半分程度が割り当てられます。 512Gの場合 250Gくらい ===== arc確認方法 ===== ==== arc_summary ==== # arc_summary -s arc ------------------------------------------------------------------------ ZFS Subsystem Report Fri Aug 19 22:26:12 2022 Linux 5.4.0-124-generic 0.8.3-1ubuntu12.14 Machine: devhv02 (x86_64) 0.8.3-1ubuntu12.14 ARC status: HEALTHY Memory throttle count: 0 ARC size (current): 5.3 % 13.4 GiB Target size (adaptive): 6.2 % 15.7 GiB Min size (hard limit): 6.2 % 15.7 GiB Max size (high water): 16:1 251.8 GiB Most Frequently Used (MFU) cache size: < 0.1 % 4.3 MiB Most Recently Used (MRU) cache size: 100.0 % 12.8 GiB Metadata cache size (hard limit): 75.0 % 188.8 GiB Metadata cache size (current): 0.9 % 1.7 GiB Dnode cache size (hard limit): 10.0 % 18.9 GiB Dnode cache size (current): < 0.1 % 892.4 KiB ARC hash breakdown: Elements max: 32.6M Elements current: 6.2 % 2.0M Collisions: 78.5M Chain max: 8 Chains: 29.8k ARC misc: Deleted: 31.9M Mutex misses: 462 Eviction skips: 414 ==== arcstat ==== # arcstat time read miss miss% dmis dm% pmis pm% mmis mm% arcsz c 22:27:51 0 0 0 0 0 0 0 0 0 13G 15G ===== メモリ使用量を制限する ===== ※zfs_arc_maxは最低で、実メモリの32/1くらいはないと、設定が反映されず。デフォルトの実メモリの半分が適応されてしまいまいます。 512Gの場合、512Gの32/1で16G程度が最低でした。 16Gにしてみる echo "17179869184" > /sys/module/zfs/parameters/zfs_arc_max === 再起動しても反映されるようにファイルにも設定 === cat << __EOM__ | tee /etc/modprobe.d/zfs.conf options zfs zfs_arc_max=17179869184 __EOM__ ==== 設定後 ==== # arcstat time read miss miss% dmis dm% pmis pm% mmis mm% arcsz c 22:35:20 0 0 0 0 0 0 0 0 0 65M 16G もしzfs_arc_maxを下げた場合は、一度メモリを開放する sync ; sysctl -w vm.drop_caches=3 {{tag>ubuntu ZFS}}