Weird memory numbers [message #20194] |
Thu, 13 September 2007 08:03 ![Go to next message Go to next message](/theme/ovz3/images/down.png) |
dagr
Messages: 83 Registered: February 2006
|
Member |
|
|
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
|
|
|
|
|
|
Re: Weird memory numbers [message #20203 is a reply to message #20198] |
Thu, 13 September 2007 09:21 ![Go to previous message Go to previous message](/theme/ovz3/images/up.png) ![Go to next message Go to next message](/theme/ovz3/images/down.png) |
dagr
Messages: 83 Registered: February 2006
|
Member |
|
|
4. So the only thing to understand left: why privvmpages << "writeable/private" * 100, correct?
Yes
1. MPM prefork implies simple forking just like in Apache 1.3 - no threads at all.
tgid - you mean gid ?
[root@vps-10811 extra]# ps -eo "sz,size,rss,vsize,pid,gid,ppid,cmd" | grep httpd
1452 1248 2488 5808 25791 0 1 /vps_core/apache-2.2.3/bin/httpd -k start
1485 1380 1704 5940 30233 2 25791 /vps_core/apache-2.2.3/bin/httpd -k start
1485 1380 1700 5940 30234 2 25791 /vps_core/apache-2.2.3/bin/httpd -k start
group 2 - daemon
2.
[root@vps-10811 extra]# pmap -d 30233
30233: /vps_core/apache-2.2.3/bin/httpd -k start
Address Kbytes Mode Offset Device Mapping
00111000 56 r-x-- 0000000000000000 007:0000f libpthread-2.3.4.so
0011f000 4 r---- 000000000000d000 007:0000f libpthread-2.3.4.so
00120000 4 rw--- 000000000000e000 007:0000f libpthread-2.3.4.so
00121000 8 rw--- 0000000000121000 000:00000 [ anon ]
00123000 76 r-x-- 0000000000000000 007:0000f libgssapi_krb5.so.2.2
00136000 4 rw--- 0000000000013000 007:0000f libgssapi_krb5.so.2.2
00137000 60 r-x-- 0000000000000000 007:0000f libresolv-2.3.4.so
00146000 4 r---- 000000000000f000 007:0000f libresolv-2.3.4.so
00147000 4 rw--- 0000000000010000 007:0000f libresolv-2.3.4.so
00148000 8 rw--- 0000000000148000 000:00000 [ anon ]
001fc000 36 r-x-- 0000000000000000 007:0000f libnss_files-2.3.4.so
00205000 4 r---- 0000000000008000 007:0000f libnss_files-2.3.4.so
00206000 4 rw--- 0000000000009000 007:0000f libnss_files-2.3.4.so
00229000 8 r-x-- 0000000000000000 007:0000f libuuid.so.1.2
0022b000 4 rw--- 0000000000001000 007:0000f libuuid.so.1.2
002c5000 60 r-x-- 0000000000000000 007:0000f libz.so.1.2.1.2
002d4000 4 rw--- 000000000000e000 007:0000f libz.so.1.2.1.2
002f5000 76 r-x-- 0000000000000000 0fd:00000 libaprutil-1.so.0.2.7
00308000 4 rw--- 0000000000012000 0fd:00000 libaprutil-1.so.0.2.7
00319000 84 r-x-- 0000000000000000 007:0000f ld-2.3.4.so
0032e000 4 r---- 0000000000015000 007:0000f ld-2.3.4.so
0032f000 4 rw--- 0000000000016000 007:0000f ld-2.3.4.so
00349000 100 r-x-- 0000000000000000 0fd:00000 libexpat.so.0.1.0
00362000 8 rw--- 0000000000019000 0fd:00000 libexpat.so.0.1.0
00385000 124 r-x-- 0000000000000000 0fd:00000 libapr-1.so.0.2.7
003a4000 4 rw--- 000000000001f000 0fd:00000 libapr-1.so.0.2.7
003a9000 132 r-x-- 0000000000000000 007:0000f libm-2.3.4.so
003ca000 4 r---- 0000000000020000 007:0000f libm-2.3.4.so
003cb000 4 rw--- 0000000000021000 007:0000f libm-2.3.4.so
003e9000 32 r-x-- 0000000000000000 007:0000f librt-2.3.4.so
003f1000 4 r---- 0000000000007000 007:0000f librt-2.3.4.so
003f2000 4 rw--- 0000000000008000 007:0000f librt-2.3.4.so
003f3000 40 rw--- 00000000003f3000 000:00000 [ anon ]
00475000 196 r-x-- 0000000000000000 007:0000f libssl.so.0.9.7a
004a6000 12 rw--- 0000000000031000 007:0000f libssl.so.0.9.7a
004a9000 1172 r-x-- 0000000000000000 007:0000f libc-2.3.4.so
005ce000 8 r---- 0000000000124000 007:0000f libc-2.3.4.so
005d0000 8 rw--- 0000000000126000 007:0000f libc-2.3.4.so
005d2000 8 rw--- 00000000005d2000 000:00000 [ anon ]
0097f000 128 r-x-- 0000000000000000 007:0000f libk5crypto.so.3.0
0099f000 4 rw--- 0000000000020000 007:0000f libk5crypto.so.3.0
009a3000 396 r-x-- 0000000000000000 007:0000f libkrb5.so.3.2
00a06000 8 rw--- 0000000000063000 007:0000f libkrb5.so.3.2
00b87000 8 r-x-- 0000000000000000 007:0000f libcom_err.so.2.1
00b89000 4 rw--- 0000000000001000 007:0000f libcom_err.so.2.1
00bf4000 8 r-x-- 0000000000000000 007:0000f libdl-2.3.4.so
00bf6000 4 r---- 0000000000001000 007:0000f libdl-2.3.4.so
00bf7000 4 rw--- 0000000000002000 007:0000f libdl-2.3.4.so
00cf1000 848 r-x-- 0000000000000000 007:0000f libcrypto.so.0.9.7a
00dc5000 72 rw--- 00000000000d4000 007:0000f libcrypto.so.0.9.7a
00dd7000 12 rw--- 0000000000dd7000 000:00000 [ anon ]
00f15000 20 r-x-- 0000000000000000 007:0000f libcrypt-2.3.4.so
00f1a000 4 r---- 0000000000004000 007:0000f libcrypt-2.3.4.so
00f1b000 4 rw--- 0000000000005000 007:0000f libcrypt-2.3.4.so
00f1c000 156 rw--- 0000000000f1c000 000:00000 [ anon ]
08048000 668 r-x-- 0000000000000000 0fd:00000 httpd
080ef000 16 rw--- 00000000000a6000 0fd:00000 httpd
080f3000 20 rw--- 00000000080f3000 000:00000 [ anon ]
09520000 1080 rw--- 0000000009520000 000:00000 [ anon ]
b7fc2000 48 rw-s- 0000000000000000 000:00033 [ anon ]
b7fce000 20 rw--- 00000000b7fce000 000:00000 [ anon ]
bfff7000 28 rw--- 00000000bfff7000 000:00000 [ stack ]
ffffe000 4 ----- 0000000000000000 000:00000 [ anon ]
mapped: 5944K writeable/private: 1564K shared: 48K
3. So you say that real consumption is oomguarpages. May be oomguarpages << privmpages when processes idle or processing same document - in other words, in docs you call privmpages some kind of memusage prediction. So in what case apache will consume privmpages which i see now?
|
|
|
|
|
|
Re: Weird memory numbers [message #20503 is a reply to message #20194] |
Wed, 19 September 2007 10:03 ![Go to previous message Go to previous message](/theme/ovz3/images/up.png) ![Go to next message Go to next message](/theme/ovz3/images/down.png) |
xemul
Messages: 248 Registered: November 2005
|
Senior Member |
|
|
Please, check with "ps -o pid,tid,comm" that all the http processes are not threads (I didn't notice whether you did this).
If they are threads, then the answer is: pmap can't handle this at all.
Otherwise, could you please create a tarball with this VE and let us download it?
Thanks,
Pavel
![http://static.openvz.org/userbars/openvz-developer.png](http://static.openvz.org/userbars/openvz-developer.png)
[Updated on: Wed, 19 September 2007 10:03] Report message to a moderator
|
|
|
|
|
|
|