VPS侦探论坛

 找回密码
 注册
查看: 11157|回复: 3

为什么内存使用这么高?

[复制链接]
发表于 2010-6-2 08:50:55 | 显示全部楼层 |阅读模式




free -m
================================================================
total       used       free     shared    buffers     cached
Mem:          2016       1952         64          0        256       1356
-/+ buffers/cache:        338       1677
Swap:         4000          0       4000


ps -aus
==================================================================
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0   2072   628 ?        Ss   May31   0:00 init [3]
root         2  0.0  0.0      0     0 ?        S<   May31   0:00 [migration/0]
root         3  0.0  0.0      0     0 ?        SN   May31   0:00 [ksoftirqd/0]
root         4  0.0  0.0      0     0 ?        S<   May31   0:00 [watchdog/0]
root         5  0.0  0.0      0     0 ?        S<   May31   0:00 [migration/1]
root         6  0.0  0.0      0     0 ?        SN   May31   0:00 [ksoftirqd/1]
root         7  0.0  0.0      0     0 ?        S<   May31   0:00 [watchdog/1]
root         8  0.0  0.0      0     0 ?        S<   May31   0:00 [events/0]
root         9  0.0  0.0      0     0 ?        S<   May31   0:00 [events/1]
root        10  0.0  0.0      0     0 ?        S<   May31   0:00 [khelper]
root        11  0.0  0.0      0     0 ?        S<   May31   0:00 [kthread]
root        15  0.0  0.0      0     0 ?        S<   May31   0:00 [kblockd/0]
root        16  0.0  0.0      0     0 ?        S<   May31   0:00 [kblockd/1]
root        17  0.0  0.0      0     0 ?        S<   May31   0:00 [kacpid]
root       116  0.0  0.0      0     0 ?        S<   May31   0:00 [cqueue/0]
root       117  0.0  0.0      0     0 ?        S<   May31   0:00 [cqueue/1]
root       120  0.0  0.0      0     0 ?        S<   May31   0:00 [khubd]
root       122  0.0  0.0      0     0 ?        S<   May31   0:00 [kseriod]
root       189  0.0  0.0      0     0 ?        S    May31   0:05 [pdflush]
root       191  0.0  0.0      0     0 ?        S<   May31   0:01 [kswapd0]
root       192  0.0  0.0      0     0 ?        S<   May31   0:00 [aio/0]
root       193  0.0  0.0      0     0 ?        S<   May31   0:00 [aio/1]
root       352  0.0  0.0      0     0 ?        S<   May31   0:00 [kpsmoused]
root       382  0.0  0.0      0     0 ?        S<   May31   0:00 [ata/0]
root       383  0.0  0.0      0     0 ?        S<   May31   0:00 [ata/1]
root       384  0.0  0.0      0     0 ?        S<   May31   0:00 [ata_aux]
root       388  0.0  0.0      0     0 ?        S<   May31   0:00 [scsi_eh_0]
root       389  0.0  0.0      0     0 ?        S<   May31   0:00 [scsi_eh_1]
root       396  0.0  0.0      0     0 ?        S<   May31   0:00 [kstriped]
root       409  0.0  0.0      0     0 ?        S<   May31   0:23 [kjournald]
root       439  0.0  0.0      0     0 ?        S<   May31   0:00 [kauditd]
root       472  0.0  0.0   2880  1484 ?        S<s  May31   0:00 /sbin/udevd -d
root      1174  0.0  0.0      0     0 ?        S<   May31   0:00 [hd-audio0]
root      1372  0.0  0.0      0     0 ?        S<   May31   0:00 [kmpathd/0]
root      1373  0.0  0.0      0     0 ?        S<   May31   0:00 [kmpathd/1]
root      1374  0.0  0.0      0     0 ?        S<   May31   0:00 [kmpath_handlerd]
root      1400  0.0  0.0      0     0 ?        S<   May31   0:00 [kjournald]
root      1604  0.0  0.0      0     0 ?        S<   May31   0:05 [kondemand/0]
root      1605  0.0  0.0      0     0 ?        S<   May31   0:05 [kondemand/1]
root      1723  0.0  0.0   2164   508 ?        Ss   May31   0:01 mcstransd
rpc       2004  0.0  0.0   1812   552 ?        Ss   May31   0:00 portmap
root      2034  0.0  0.0      0     0 ?        S<   May31   0:00 [rpciod/0]
root      2035  0.0  0.0      0     0 ?        S<   May31   0:00 [rpciod/1]
root      2093  0.0  0.0   6096  1320 ?        Ss   May31   0:00 nginx: master process /usr/local/nginx/sbin/nginx
dbus      2099  0.0  0.0  13124  1364 ?        Ssl  May31   0:00 dbus-daemon --system
root      2115  0.0  0.5  43804 11948 ?        Ssl  May31   0:02 /usr/bin/python -E /usr/sbin/setroubleshootd
root      2128  0.0  0.0   2168   764 ?        Ss   May31   0:00 /usr/sbin/hcid
root      2132  0.0  0.0   1744   508 ?        Ss   May31   0:00 /usr/sbin/sdpd
root      2156  0.0  0.0      0     0 ?        S<   May31   0:00 [krfcommd]
68        2231  0.0  0.1   5720  3920 ?        Ss   May31   0:00 hald
root      2232  0.0  0.0   3152  1084 ?        S    May31   0:00 hald-runner
68        2240  0.0  0.0   2016   828 ?        S    May31   0:00 hald-addon-acpi: listening on acpid socket /var/run/acpid.so
root      2272  0.0  0.0   1912   448 ?        Ss   May31   0:00 /usr/bin/hidd --server
root      2352  0.0  0.0   2724   852 ?        Ss   May31   0:00 xinetd -stayalive -pidfile /var/run/xinetd.pid
root      2397  0.0  0.0   1900   468 ?        Ss   May31   0:00 gpm -m /dev/input/mice -t exps2
xfs       2437  0.0  0.0   3536  1328 ?        Ss   May31   0:00 xfs -droppriv -daemon
root      2508  0.0  0.5  25652 10372 ?        SN   May31   0:00 /usr/bin/python -tt /usr/sbin/yum-updatesd
root      2510  0.0  0.0   2556  1172 ?        SN   May31   0:00 /usr/libexec/gam_server
root      2527  0.0  0.0   3504   520 ?        S    May31   0:00 /usr/sbin/smartd -q never
root      2530  0.0  0.0   1660   444 tty1     Ss+  May31   0:00 /sbin/mingetty tty1
root      2531  0.0  0.0   1660   448 tty2     Ss+  May31   0:00 /sbin/mingetty tty2
root      2532  0.0  0.0   1660   448 tty3     Ss+  May31   0:00 /sbin/mingetty tty3
root      2533  0.0  0.0   1660   444 tty4     Ss+  May31   0:00 /sbin/mingetty tty4
root      2534  0.0  0.0   1660   448 tty5     Ss+  May31   0:00 /sbin/mingetty tty5
root      2535  0.0  0.0   1660   448 tty6     Ss+  May31   0:00 /sbin/mingetty tty6
root      2592  0.0  0.1   9916  2856 ?        Ss   May31   0:00 sshd: root@pts/0
root      2594  0.0  0.0   4532  1452 pts/0    Ss+  May31   0:00 -bash
root      3134  0.0  0.0   1728   612 ?        Ss   May31   0:01 syslogd -m 0
root      3137  0.0  0.0   1680   404 ?        Ss   May31   0:00 klogd -x
root      3448  0.0  0.0      0     0 ?        S    Jun01   0:00 [pdflush]
root      4078  0.0  0.0   7228   856 ?        Ss   Jun01   0:00 pure-ftpd (SERVER)
root      4327  0.0  0.5  12160 10416 ?        Ss   May31   0:00 /usr/sbin/restorecond
root      4374  0.0  0.0  27256  1364 ?        Ssl  May31   0:00 automount
root      4420  0.0  0.0  12520   768 ?        S<sl May31   0:00 auditd
root      4422  0.0  0.0  12076   696 ?        S<sl May31   0:00 /sbin/audispd
root      4455  0.0  0.0   9232  1904 ?        Ss   May31   0:00 sendmail: accepting connections
smmsp     4464  0.0  0.0   8148  1520 ?        Ss   May31   0:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue
root      4534  0.0  0.1  10124  2332 ?        Ss   May31   0:00 cupsd
root      4570  0.0  0.0   1676   528 ?        Ss   May31   0:00 /usr/sbin/acpid
root      4621  0.0  0.0  12860  1380 ?        Ssl  May31   0:00 pcscd
root      4641  0.0  0.0   2268   440 ?        Ss   May31   0:00 /usr/sbin/atd
root      4731  0.0  0.0   7076  1060 ?        Ss   May31   0:00 /usr/sbin/sshd
root      4766  0.0  0.0   5816   644 ?        Ss   May31   0:00 rpc.idmapd
rpcuser   4811  0.0  0.0   1868   736 ?        Ss   May31   0:00 rpc.statd
avahi     4844  0.0  0.0   2592  1280 ?        Ss   May31   0:00 avahi-daemon: running [edong.local]
avahi     4845  0.0  0.0   2592   428 ?        Ss   May31   0:00 avahi-daemon: chroot helper
root      4892  0.0  0.0   5288  1184 ?        Ss   May31   0:00 crond
root     17371  0.0  0.1  10092  3008 ?        Ss   08:32   0:00 sshd: root@pts/1
root     17376  0.0  0.0   4640  1488 pts/1    Ss   08:32   0:00 -bash
www      18053  1.4  1.7  40520 35156 ?        D    08:42   0:03 nginx: worker process
root     18091  0.0  0.0   4492  1132 pts/1    S    08:42   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/loca
mysql    18194  0.9  0.3  37748  7968 pts/1    Sl   08:42   0:02 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql -
root     18208  0.0  0.2  23228  4176 ?        Ss   08:43   0:00 /usr/local/php/bin/php-cgi --fpm --fpm-config /usr/local/php
www      18209  0.0  0.3  23596  6764 ?        S    08:43   0:00 /usr/local/php/bin/php-cgi --fpm --fpm-config /usr/local/php
www      18210  0.0  0.2  23228  6108 ?        S    08:43   0:00 /usr/local/php/bin/php-cgi --fpm --fpm-config /usr/local/php
www      18211  0.0  0.2  23580  6148 ?        S    08:43   0:00 /usr/local/php/bin/php-cgi --fpm --fpm-config /usr/local/php
www      18212  0.0  0.2  23572  6116 ?        S    08:43   0:00 /usr/local/php/bin/php-cgi --fpm --fpm-config /usr/local/php
www      18213  0.0  0.2  23228  6024 ?        S    08:43   0:00 /usr/local/php/bin/php-cgi --fpm --fpm-config /usr/local/php
root     18607  0.0  0.0   4260   952 pts/1    R+   08:47   0:00 ps -aux

[ 本帖最后由 xxnimu 于 2010-6-2 08:53 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2010-6-2 09:32:35 | 显示全部楼层

回复 1# 的帖子



首先你要搞清楚的是Linux和Windows的内存机制是不一样的。

在Linux中经常发现空闲内存很少,似乎所有的内存都被系统占用了,表面感觉是内存不够用了,其实不然。这是Linux内存管理的一个优秀特性,在这方面,区别于 Windows的内存管理。主要特点是,无论物理内存有多大,Linux 都将其充分利用,将一些程序调用过的硬盘数据读入内存,利用内存读写的高速特性来提高Linux系统的数据访问性能。而Windows 是只在需要内存时,才为应用程序分配内存,并不能充分利用大容量的内存空间。换句话说,每增加一些物理内存,Linux 都将能充分利用起来,发挥了硬件投资带来的好处,而Windows只将其做为摆设,即使增加8GB甚至更大。
Linux 的这一特性,主要是利用空闲的物理内存,划分出一部份空间,做为 cache 和 buffers ,以此提高数据访问性能。
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2010-6-3 16:25:56 | 显示全部楼层

这也是我一直在纳闷的
现在终于明白了
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2010-6-3 21:59:38 | 显示全部楼层

回复 3# 的帖子




Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-10-18 14:32 , Processed in 0.027070 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表