I made expirement to understand whether i can see how much memory exactly my vps consumes
I installed apache and run it with 100 start processes (prefork mpm model)
[[email]root@vps-10811[/email] conf]# ps -eo "sz,size,rss,vsize,pid,cmd" | grep httpd| wc -l
102
[[email]root@vps-10811[/email] conf]# ps -eo "sz,size,rss,vsize,pid,cmd" | grep httpd
1451 1244 2520 5804 30193 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2136 5936 32109 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2136 5936 32110 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2136 5936 32111 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2140 5936 32112 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2140 5936 32113 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2140 5936 32114 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2140 5936 32115 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2140 5936 32116 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2140 5936 32117 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2144 5936 32118 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2140 5936 32119 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2140 5936 32120 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2140 5936 32121 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2140 5936 32122 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2140 5936 32123 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2140 5936 32124 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2140 5936 32125 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2140 5936 32126 /vps_core/apache-2.2.3/bin/httpd -k start
1484 1376 2140 5936 32127 /vps_core/apache-2.2.3/bin/httpd -k start
.................
1451 1244 1720 5804 32217 /vps_core/apache-2.2.3/bin/httpd -k start
1451 1244 1720 5804 32219 /vps_core/apache-2.2.3/bin/httpd -k start
395 160 520 1580 5144 grep httpd
ps shows memory usage in tricky way , so i checked it by pmap
[[email]root@vps-10811[/email] conf]# pmap -d 32217
.........................
mapped: 5808K writeable/private: 1428K shared: 48K
writeable/private: 1428K - is the minimum memory which process uses and doesnt share.
Its close to size 1451K from ps in our case . Ie 100x1458 = 150 Mb
Now lets see what beancounters give us
[[email]root@vps-10811[/email] conf]# cat /proc/user_beancounters
Version: 2.5
uid resource held maxheld barrier limit failcnt
10811: kmemsize 11638464 13987632 20752512 29036012 0
lockedpages 0 0 32 32 0
privvmpages 24687 27632 600000 700000 0
shmpages 652 661 249152 249152 0
dummy 0 0 0 0 0
numproc 110 119 200 200 0
physpages 7099 7854 0 2147483647 0
vmguarpages 0 0 60000 2147483647 0
oomguarpages 7099 7854 60000 2147483647 0
numtcpsock 6 174 300 300 0
numflock 3 4 100 110 0
numpty 1 1 16 16 0
numsiginfo 0 101 256 256 0
tcpsndbuf 51428 206412 1319488 2524288 0
tcprcvbuf 84888 942160 1319488 2524288 0
othersockbuf 2236 9800 5036896 5536896 0
dgramrcvbuf 0 13980 232096 500000 0
numothersock 4 9 100 100 0
dcachesize 0 0 1800000 2000000 0
numfile 1087 1398 4048 4048 0
dummy 0 0 0 0 0
Both privvmpages (~100Mb) and oomguarpages(~28Mb) show me numbers far from expected. Im pretty sure about pmap method , so whats the trick ?
( 2.6.9-023stab044.4-enterprise , vzctl-3.0.13-1 )
[Updated on: Thu, 13 September 2007 08:05]
Report message to a moderator