我在Ubuntu 12.04上从
their PPA开始运行ZoL 0.6.2.它位于具有16GB内存的主机上,旨在使用KVM / Libvirt运行某些VM.一段时间后,ZoL使用了大量内存,在运行一些虚拟机时达到了98%的RAM使用率.这导致新进程拒绝启动“无法分配内存”.在使用ZFS之前,我甚至无法启动所有虚拟机,使用大约40-50%的RAM.
据我所知,如果没有调整,ZoL应该在系统内存不足时立即释放内存.嗯,事实并非如此.所以我决定将arc_max设置为1GB.
# echo 1073741824 >> /sys/module/zfs/parameters/zfs_arc_max
不过,它不释放任何记忆.
从下面的ARC统计数据中可以看出,它使用的内存比配置的内存多(比较c = 7572030912和c_max = 1073741824).
我在这做错了什么?
# cat /proc/spl/kstat/zfs/arcstats 4 1 0x01 84 4032 43757119584 392054268420115 name type data hits 4 28057644 misses 4 13975282 demand_data_hits 4 19632274 demand_data_misses 4 571809 demand_Metadata_hits 4 6333604 demand_Metadata_misses 4 289110 prefetch_data_hits 4 1903379 prefetch_data_misses 4 12884520 prefetch_Metadata_hits 4 188387 prefetch_Metadata_misses 4 229843 mru_hits 4 15390332 mru_ghost_hits 4 1088944 mfu_hits 4 10586761 mfu_ghost_hits 4 169152 deleted 4 35432344 recycle_miss 4 701686 mutex_miss 4 35304 evict_skip 4 60416647 evict_l2_cached 4 0 evict_l2_eligible 4 3022396862976 evict_l2_ineligible 4 1602907651584 hash_elements 4 212777 hash_elements_max 4 256438 hash_collisions 4 17163377 hash_chains 4 51485 hash_chain_max 4 10 p 4 1527347963 c 4 7572030912 c_min 4 1038188800 c_max 4 1073741824 size 4 7572198224 hdr_size 4 66873056 data_size 4 7496095744 other_size 4 9229424 anon_size 4 169150464 anon_evict_data 4 0 anon_evict_Metadata 4 0 mru_size 4 1358216192 mru_evict_data 4 1352400896 mru_evict_Metadata 4 508928 mru_ghost_size 4 6305992192 mru_ghost_evict_data 4 4919159808 mru_ghost_evict_Metadata 4 1386832384 mfu_size 4 5968729088 mfu_evict_data 4 5627991552 mfu_evict_Metadata 4 336846336 mfu_ghost_size 4 1330455552 mfu_ghost_evict_data 4 1287782400 mfu_ghost_evict_Metadata 4 42673152 l2_hits 4 0 l2_misses 4 0 l2_Feeds 4 0 l2_rw_clash 4 0 l2_read_bytes 4 0 l2_write_bytes 4 0 l2_writes_sent 4 0 l2_writes_done 4 0 l2_writes_error 4 0 l2_writes_hdr_miss 4 0 l2_evict_lock_retry 4 0 l2_evict_reading 4 0 l2_free_on_write 4 0 l2_abort_lowmem 4 0 l2_cksum_bad 4 0 l2_io_error 4 0 l2_size 4 0 l2_asize 4 0 l2_hdr_size 4 0 l2_compress_successes 4 0 l2_compress_zeros 4 0 l2_compress_failures 4 0 memory_throttle_count 4 0 duplicate_buffers 4 0 duplicate_buffers_size 4 0 duplicate_reads 4 0 memory_direct_count 4 66583 memory_indirect_count 4 7657293 arc_no_grow 4 0 arc_tempreserve 4 0 arc_loaned_bytes 4 0 arc_prune 4 0 arc_Meta_used 4 427048272 arc_Meta_limit 4 2076377600 arc_Meta_max 4 498721632 # free -m total used free shared buffers cached Mem: 15841 15385 456 0 75 74 -/+ buffers/cache: 15235 606 Swap: 0 0 0
解决方法
恕我直言,/ sys / module / zfs / parameters中的参数只能设置为0/1 – 禁用/启用.“
更正:取决于参数
更正:取决于参数
我在同一条船上想要限制zfs的内存使用量,似乎必须创建一个/etc/modprobe.d/zfs.conf文件并在那里输入参数和所需的值.此更改将在重新启动时生效.
echo“options zfs zfs_arc_max = 34359738368”>> /etc/modprobe.d/zfs.conf
要实现正在运行的模块,可以更改zfs_arc_max参数.
echo“34359738368”> / SYS /模块/ ZFS /参数/ zfs_arc_max