我最近迁移了托管服务提供商,在此过程中,我的发行版从 CentOS 5.9 64 位更改为 CentOS 6.4 64 位。尽管 RAM 稍多一些(1 GiB 而不是 768 MiB),但运行 CentOS 6.4 的新 VPS 总是内存不足。起初我怀疑是缓冲区和缓存的问题,但 free 返回的值似乎不一致。以下是一些输出。
顶部
top - 14:16:22 up 13:27, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 44 total, 1 running, 43 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1048576k total, 1048576k used, 0k free, 0k buffers
Swap: 0k total, 0k used, 0k free, 0k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
17678 tomcat 18 0 1772m 182m 42m S 0.0 17.8 0:09.80 java
3663 root 15 0 89788 21m 1960 S 0.0 2.1 0:00.70 miniserv.pl
3355 mysql 18 0 498m 20m 5872 S 0.0 2.0 0:01.31 mysqld
16358 root 18 0 403m 14m 8364 S 0.0 1.4 0:00.09 httpd
16360 apache 15 0 403m 7344 768 S 0.0 0.7 0:00.00 httpd
3692 root 18 0 71780 3708 2864 S 0.0 0.4 0:02.37 sshd
3751 root 16 0 71780 3624 2828 S 0.0 0.3 0:00.03 sshd
3422 root 15 0 82504 2364 736 S 0.0 0.2 0:00.13 sendmail
3170 haldaemo 15 0 24752 2316 1948 S 0.0 0.2 0:00.00 hald
3430 smmsp 18 0 78232 2092 692 S 0.0 0.2 0:00.00 sendmail
3694 root 15 0 11580 1888 1416 S 0.0 0.2 0:00.16 bash
3143 root 18 0 243m 1576 1092 S 0.0 0.2 0:00.03 rsyslogd
1 root 15 0 19232 1528 1288 S 0.0 0.1 0:19.65 init
3253 root 19 0 11308 1492 1236 S 0.0 0.1 0:00.00 mysqld_safe
13451 sockd 15 0 91792 1308 752 S 0.0 0.1 0:00.00 sockd
3387 sockd 18 0 91792 1304 752 S 0.0 0.1 0:00.37 sockd
3527 root 15 0 21308 1272 684 S 0.0 0.1 0:00.02 crond
vmstat -s ;免费
1048576 total memory
1048576 used memory
0 active memory
0 inactive memory
0 free memory
0 buffer memory
0 swap cache
0 total swap
0 used swap
0 free swap
37863 non-nice user cpu ticks
0 nice user cpu ticks
14367 system cpu ticks
116512866 idle cpu ticks
30 IO-wait cpu ticks
0 IRQ cpu ticks
0 softirq cpu ticks
0 stolen cpu ticks
413960 pages paged in
15754892 pages paged out
0 pages swapped in
0 pages swapped out
0 interrupts
1704963753 CPU context switches
1395474517 boot time
46700605 forks
total used free shared buffers cached
Mem: 1048576 1048576 0 0 0 0
-/+ buffers/cache: 1048576 0
Swap: 0 0 0
微电子
PID User Command Swap USS PSS RSS
3390 sockd sockd: 0 136 145 820
13451 sockd sockd: 0 128 172 1308
13450 sockd sockd: 0 136 173 916
13452 sockd sockd: 0 136 173 916
13448 sockd sockd: 0 152 181 916
13459 sockd sockd: 0 160 185 916
13454 sockd sockd: 0 176 190 916
13455 sockd sockd: 0 176 190 916
13456 sockd sockd: 0 176 190 916
13457 sockd sockd: 0 176 190 916
13458 sockd sockd: 0 176 190 916
13449 sockd sockd: 0 136 192 1080
7205 sockd sockd: 0 180 197 916
7208 sockd sockd: 0 180 197 916
7240 sockd sockd: 0 180 197 916
7243 sockd sockd: 0 180 197 916
13453 sockd sockd: 0 184 197 916
3637 root /usr/sbin/atd 0 200 200 480
7234 sockd sockd: 0 188 201 916
7237 sockd sockd: 0 188 201 916
3217 root xinetd -stayalive -pidfile 0 228 232 984
3171 root hald-runner 0 196 240 1268
1 root ini 0 240 254 1528
3253 root /bin/sh /usr/bin/mysqld_saf 0 256 270 1492
3387 sockd sockd -D 0 268 303 1304
3378 root /usr/sbin/saslauthd -m /var 0 40 326 964
3379 root /usr/sbin/saslauthd -m /var 0 40 326 660
1233 root /sbin/udevd -d 0 376 377 700
3143 root /sbin/rsyslogd -i /var/run/ 0 484 498 1576
3694 root -bash 0 472 516 1888
3527 root crond 0 588 589 1272
3160 dbus dbus-daemon --system 0 620 622 1012
3209 root /usr/sbin/sshd 0 684 687 1212
3170 haldaemon hald 0 812 889 2316
3751 root sshd: root 0 804 987 3624
3692 root sshd: root@pts/0 0 876 1059 3708
3430 smmsp sendmail: Queue runner@01:0 0 1400 1411 2092
3422 root sendmail: accepting connect 0 1628 1644 2364
16360 apache /usr/sbin/httpd 0 168 3376 7344
16358 root /usr/sbin/httpd 0 344 3810 14912
17766 root python /usr/sbin/smem 0 5684 5752 7580
3355 mysql /usr/libexec/mysqld --based 0 15248 16070 21120
3663 root /usr/bin/perl /usr/libexec/ 0 19728 19909 21648
17678 tomcat /usr/java/latest/bin/../bin 0 184952 185049 186656
猫/proc/meminfo
MemTotal: 1048576 kB
MemFree: 0 kB
Buffers: 0 kB
Cached: 0 kB
SwapCached: 0 kB
Active: 0 kB
Inactive: 0 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 1048576 kB
LowFree: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 0 kB
Mapped: 0 kB
Slab: 0 kB
PageTables: 0 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 0 kB
Committed_AS: 0 kB
VmallocTotal: 0 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
Hugepagesize: 2048 kB
这些数字加起来只有 250 MiB 左右。我想知道将 VPS 重新配置为 CentOS 5.9 32 位是否有帮助,但那样我就必须更改一些 64 位应用程序。
答案1
使用 OpenVZ,您获得的内存值基本上毫无意义。您获得的唯一有意义的值是每个进程的驻留集大小。OpenVZ 将物理内存和交换作为跨容器的系统资源进行管理。它通常被认为是一种低成本、低性能的选择,特别是因为它在容器之间提供了非常低级别的内存和 CPU 隔离。