为什么我的VPS使用4.5GB的RAM,即使没有服务正在运行?

我的VPS使用很多RAM。 为了确定问题,我停止了每一项服务,VPS仍然使用4.5GB的RAM。 VPS在XEN上运行,所以RAM不共享。

停止所有服务(ssh除外)后,这是free -m的输出:

[root@node3 ~]# free -m total used free shared buffers cached Mem: 6928 5510 1417 0 130 704 -/+ buffers/cache: 4676 2251 Swap: 3071 106 2965 

有人可以帮我吗? 非常感谢。

 [root@node3 custombuild]# ps aux | sort -b -k 4 | tail acusu161 307520 0.0 0.0 94344 1828 ? SN 14:42 0:00 sshd: acusu161@pts/2 root 301805 0.0 0.0 94344 3352 ? SNs 14:19 0:00 sshd: acusu161 [priv] root 307459 0.0 0.0 94344 3360 ? SNs 14:41 0:00 sshd: acusu161 [priv] acusu161 301833 0.0 0.0 94484 1896 ? SN 14:19 0:00 sshd: acusu161@pts/1 acusu161 328664 0.0 0.0 95128 1748 ? SN 16:24 0:00 sshd: acusu161@pts/4 root 328660 0.0 0.0 95128 3348 ? SNs 16:24 0:00 sshd: acusu161 [priv] named 10398 0.0 0.1 589860 7896 ? Ssl Jul23 0:02 named -u named root 340628 0.0 0.3 127764 26884 ? SNs 16:48 0:01 lfd - sleeping root 6508 0.0 0.4 38936 32788 ? S<Lsl Jul23 0:00 iscsiuio USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND 

没有什么可担心的,linux喜欢caching内容,当新进程请求内存时,caching将被覆盖。

你可以清除它。 因人而异。

  sudo sync && sudo sysctl -w vm.drop_caches=3 && sudo sysctl -w vm.drop_caches=0 

来源: http : //duopetalflower.blogspot.ca/2009/09/clearing-cache-memory-in-linux-using.html

  free && sync && echo 3 > /proc/sys/vm/drop_caches && free 

来源: http : //www.commandlinefu.com/commands/view/1026/empty-the-linux-buffer-cache

 To free pagecache: echo 1 > /proc/sys/vm/drop_caches To free dentries and inodes: echo 2 > /proc/sys/vm/drop_caches To free pagecache, dentries and inodes: echo 3 > /proc/sys/vm/drop_caches 

来源: https : //stackoverflow.com/questions/8066252/invalid-argument-error-for-sysctl-vm-drop-caches-key-in-ubuntu-11-10-kernel-3

尝试安装实用程序(如“ htop ”)并按内存使用率(MEM%)对内存进行sorting(F6),以查看哪些进程正在使用多less内存。