我使用的是 512MB VPS,它只运行 Apache(无流量),并且每隔几个小时使用 Restic 将 crontab 备份到 Onedrive。我遇到了高内存和中等交换消耗,显然没有负责任的进程,如下所示top
:
Tasks: 192 total, 1 running, 191 sleeping, 0 stopped, 0 zombie
%Cpu(s): 5,6 us, 11,1 sy, 0,0 ni, 83,3 id, 0,0 wa, 0,0 hi, 0,0 si, 0,0 st
MiB Mem : 437,5 total, 14,4 free, 363,9 used, 59,2 buff/cache
MiB Swap: 1952,0 total, 1836,7 free, 115,2 used. 62,1 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
651 root 20 0 91292 2684 2276 S 6,2 0,6 0:04.37 vmtoolsd
1 root 20 0 165324 2636 2200 S 0,0 0,6 0:02.18 systemd
2 root 20 0 0 0 0 S 0,0 0,0 0:00.01 kthreadd
3 root 0 -20 0 0 0 I 0,0 0,0 0:00.00 rcu_gp
4 root 0 -20 0 0 0 I 0,0 0,0 0:00.00 rcu_par_gp
6 root 0 -20 0 0 0 I 0,0 0,0 0:00.00 kworker/0:0H-events_highpri
8 root 0 -20 0 0 0 I 0,0 0,0 0:00.00 mm_percpu_wq
9 root 20 0 0 0 0 S 0,0 0,0 0:00.00 rcu_tasks_rude_
10 root 20 0 0 0 0 S 0,0 0,0 0:00.00 rcu_tasks_trace
11 root 20 0 0 0 0 S 0,0 0,0 0:00.35 ksoftirqd/0
12 root 20 0 0 0 0 I 0,0 0,0 0:00.74 rcu_sched
13 root rt 0 0 0 0 S 0,0 0,0 0:00.01 migration/0
15 root 20 0 0 0 0 S 0,0 0,0 0:00.00 cpuhp/0
17 root 20 0 0 0 0 S 0,0 0,0 0:00.00 kdevtmpfs
18 root 0 -20 0 0 0 I 0,0 0,0 0:00.00 netns
19 root 20 0 0 0 0 S 0,0 0,0 0:00.00 kauditd
20 root 20 0 0 0 0 S 0,0 0,0 0:00.00 khungtaskd
和free -m
:
Mem: 437 363 5 0 68 52
Swap: 1951 113 1838
我检查了它是否被 tmpfs 使用mount | grep tmpfs
udev on /dev type devtmpfs (rw,nosuid,relatime,size=204664k,nr_inodes=51166,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=44804k,mode=755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=44800k,nr_inodes=11200,mode=700)
但它们各自都不占用太多内存df -h
Filesystem Size Used Avail Use% Mounted on
udev 200M 0 200M 0% /dev
tmpfs 44M 976K 43M 3% /run
/dev/mapper/vg00-lv01 7,4G 4,8G 2,3G 69% /
tmpfs 219M 0 219M 0% /dev/shm
tmpfs 5,0M 0 5,0M 0% /run/lock
/dev/loop1 64M 64M 0 100% /snap/core20/1828
/dev/loop3 117M 117M 0 100% /snap/core/14784
/dev/loop2 64M 64M 0 100% /snap/core20/1852
/dev/loop4 45M 45M 0 100% /snap/certbot/2913
/dev/loop0 117M 117M 0 100% /snap/core/14946
/dev/loop5 44M 44M 0 100% /snap/certbot/2836
/dev/sda1 462M 85M 349M 20% /boot
tmpfs 44M 4,0K 44M 1% /run/user/0
不确定是否相关,但这是输出systemd-cgtop -m
Control Group Tasks %CPU Memory Input/s Output/s
/ 217 - 425.3M - -
system.slice 51 0.1 75.8M - -
system.slice/nagios-nrpe-server-args.service 1 - 11.7M - -
user.slice 5 1.5 9.9M - -
system.slice/snapd.service 9 0.0 9.7M - -
user.slice/user-0.slice 5 1.5 9.6M - -
user.slice/user-0.slice/session-1.scope 3 1.5 7.8M - -
system.slice/apache2.service 7 0.0 6.2M - -
system.slice/systemd-journald.service 1 - 5.7M - -
system.slice/cron.service 1 - 3.9M - -
init.scope 1 - 3.6M - -
system.slice/mariadb.service 8 0.0 2.3M - -
system.slice/open-vm-tools.service 2 0.1 2.1M - -
system.slice/ssh.service 1 - 1.7M - -
system.slice/[email protected] 8 - 1.3M - -
system.slice/rsyslog.service 4 - 1.1M - -
user.slice/user-0.slice/[email protected] 2 - 1.1M - -
system.slice/systemd-udevd.service 1 - 888.0K - -
system.slice/dbus.service 1 - 736.0K - -
system.slice/system-systemd\x2dfsck.slice - - 708.0K - -
system.slice/vsftpd.service 1 - 656.0K - -
system.slice/systemd-logind.service 1 - 560.0K - -
system.slice/system-getty.slice 1 - 432.0K - -
我读到过膨胀可能是问题vmware-toolbox-cmd stat balloon
所在,但
0 MB
系统信息hostnamectl
Static hostname: localhost
Icon name: computer-vm
Chassis: vm
Machine ID: 24fcbea78a5643359430d9f0b6721da1
Boot ID: 96efe542e3ae466898f9e5508368c4ff
Virtualization: vmware
Operating System: Debian GNU/Linux 11 (bullseye)
Kernel: Linux 5.10.0-21-amd64
Architecture: x86-64
我尝试重新启动服务器并停止 Apache,但没有结果,不确定现在我能尝试什么。