ZFS强吃内存
原创2025年12月25日小于 1 分钟
ZFS强吃内存
背景:我32G的内存,才开了3个虚拟机,内存竟然接近91%,需要找到到底谁在吃内存。
环境信息
PVE版本信息
root@:~# pveversion -v
proxmox-ve: 8.4.0 (running kernel: 6.8.12-15-pve)
pve-manager: 8.4.14 (running version: 8.4.14/b502d23c55afcba1)
proxmox-kernel-helper: 8.1.4
proxmox-kernel-6.8: 6.8.12-15
root@:~# zfs --version
zfs-2.2.8-pve1
zfs-kmod-2.2.8-pve1查看当前虚拟机内存使用情况
# 内存使用情况
root@:~# free -g
total used free shared buff/cache available
Mem: 31 25 9 0 1 5
Swap: 7
## top 无异常
root@:~# top
## 查看占内存的进程 无异常
root@:~# ps aux --sort=-%mem | head -15
## 查看ARC (Adaptive Replacement Cache(自适应替换缓存)) 元凶所在
root@:~# arc_summary | grep "ARC size"
ARC size (current): 90.4 % 14.1 GiB修改ARC大小
我的ZFS主要是存放文件,磁盘未被虚拟机使用,我限制未
2G
root@:~# echo "options zfs zfs_arc_max=2147483648" | tee /etc/modprobe.d/zfs.conf
options zfs zfs_arc_max=2147483648
# 更新内核
root@:~# update-initramfs -u
# 重启
root@:~# reboot
# 查看ARC大小
root@:~# arc_summary | grep "ARC size"
ARC size (current): 0.7 % 14.6 MiB待后面观察
root@:~# cat /sys/module/zfs/parameters/zfs_arc_max
2147483648