OpenVZ Forum


Home » General » Support » Memory usage
Memory usage [message #2468] Thu, 06 April 2006 10:31 Go to next message
eugeniopacheco is currently offline  eugeniopacheco
Messages: 40
Registered: November 2005
Member
Hi,

I'm a big fan of openvz, I think it's wonderful, but as I'm a newbie at it I don't fully know how it works...

Well... I'm running openvz on a Celeron 3,066 1024MB RAM 160GB HD and it's working fine, but, I used vzsplit -n 10 -f vps.10 and used this config file with vzctl set VPSID --applyconfig vps.10 --save

I'm running only 3 VPS and when I run top on the host it shows this:

Cpu(s): 1.2% us, 0.0% sy, 0.0% ni, 98.8% id, 0.0% wa, 0.0% hi, 0.0% si
Mem: 1025084k total, 1002164k used, 22920k free, 95024k buffers

Is it supposed to look like that? To have the memory all used up like that? Does openvz by default use the entire memory and then split into the VPS's? Is that how it works?

Here's what my vzmemcheck shows:

[root@t248 ~]# vzmemcheck
Output values in %
LowMem LowMem RAM MemSwap MemSwap Alloc Alloc Alloc
util commit util util commit util commit limit
0.81 28.58 5.57 5.57 28.04 23.29 28.04 124.97
[root@t248 ~]# vzmemcheck -A
Output values in Mbytes
LowMem LowMem RAM MemSwap MemSwap Alloc Alloc Alloc
util commit util util commit util commit limit
2.63 93.45 55.74 55.74 280.68 233.10 280.68 1251.05
326.00 326.00 1001.00 1001.00 1001.00 1001.00 1001.00 1001.00
[root@t248 ~]# vzmemcheck -Av
Output values in Mbytes
veid LowMem LowMem RAM MemSwap MemSwap Alloc Alloc Alloc
util commit util util commit util commit limit
101 2.15 24.79 49.62 49.62 87.20 199.25 87.20 358.57
104 0.28 34.33 3.92 3.92 96.74 30.81 96.74 446.24
105 0.21 34.33 2.21 2.21 96.74 3.05 96.74 446.24
------------------------------------------------------------ -------------
Summary: 2.63 93.45 55.74 55.74 280.68 233.10 280.68 1251.05
326.00 326.00 1001.00 1001.00 1001.00 1001.00 1001.00 1001.00
[root@t248 ~]# vzmemcheck -v
Output values in %
veid LowMem LowMem RAM MemSwap MemSwap Alloc Alloc Alloc
util commit util util commit util commit limit
101 0.66 7.58 4.96 4.96 8.71 19.90 8.71 35.82
104 0.09 10.50 0.39 0.39 9.66 3.08 9.66 44.58
105 0.06 10.50 0.22 0.22 9.66 0.30 9.66 44.58
------------------------------------------------------------ -------------
Summary: 0.81 28.58 5.57 5.57 28.04 23.29 28.04 124.97

I read the User manual and it says that if any of these numbers is over 1 it's a problem with configuration... Here's what my vps.10 config template looks like:

# Configuration file generated by vzsplit for 10 VPS
# on HN with total amount of physical mem 1001 Mb
# low memory 817 Mb, swap size 0 Mb, Max treads 8000
# Resourse commit level 0:
# Free resource distribution. Any parameters may be increased
# Primary parameters
NUMPROC="800:800"
AVNUMPROC="209:209"
NUMTCPSOCK="800:800"
NUMOTHERSOCK="800:800"
VMGUARPAGES="15977:2147483647"

# Secondary parameters
KMEMSIZE="17141514:18855665"
TCPSNDBUF="2437038:5713838"
TCPRCVBUF="2437038:5713838"
OTHERSOCKBUF="1218519:4495319"
DGRAMRCVBUF="1218519:1218519"
OOMGUARPAGES="15977:2147483647"
PRIVVMPAGES="95862:105448"

# Auxiliary parameters
LOCKEDPAGES="836:836"
SHMPAGES="9586:9586"
PHYSPAGES="0:2147483647"
NUMFILE="6688:6688"
NUMFLOCK="668:734"
NUMPTY="80:80"
NUMSIGINFO="1024:1024"
DCACHESIZE="3740085:3852288"
NUMIPTENT="200:200"
DISKSPACE="5242880:6242880"
DISKINODES="593396:622736"
CPUUNITS="13738"

Is this all right?

Also, here is what vzcpucheck looks like:

[root@t248 vz-scripts]# vzcpucheck
Current CPU utilization: 42664
Power of the node: 151267

I haven't got any shortage on memory, but I'm affraid that if I run more stuff on the VPS's or if I add more VPS's then I'm gonna get memory shortage... By the way, what's the configuration for RAM memory limitation? Is it oomguarpages or vmguarpages? I read the user manual and I believe it's one of these...

Regards and thanks for having such a wonderful software for free:)
Re: Memory usage [message #2526 is a reply to message #2468] Sat, 08 April 2006 19:17 Go to previous messageGo to next message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

eugeniopacheco, thanks a lot for such a detailed information, it really helps and wish all the users were doing so! Laughing

AFAICS, from your message this line makes you worry:
Mem: 1025084k total, 1002164k used, 22920k free, 95024k buffers
correct?

It is fully ok. This _doesn't_ mean, that memory is used by VPSs or its processes. Most likely your memory is used for caches. You can check this in cat /proc/meminfo output.
Kernel dynamically uses memory for disk caches, so "free" memory is _totally_ unused memory (22Mb in your case), while "used" memory includes caches which are reclaimed when needed automatically.

Now about UBC settings. oomguarpages and vmguarpages are _guarantees_, not limits. oomguarpages guarantees that Out-Of-Memory killer won't try to kill processes in the VPS if it uses less than guaranteed memory pages. vmguarpages guarantees that OS will allow VPS to mmap such amount of private pages.
And the limit your are looking for is 'privvmpages' I think.


http://static.openvz.org/userbars/openvz-developer.png
Re: Memory usage [message #2589 is a reply to message #2526] Mon, 10 April 2006 20:51 Go to previous messageGo to next message
eugeniopacheco is currently offline  eugeniopacheco
Messages: 40
Registered: November 2005
Member
Hi,

Thanks a lot for your answer...

Yes, I do believe that the limit would be the privvmpages setting... What is the unit used by privvmpages? I had a VPS running with 95862:105448 and I couldn't run 1 ircd, 1 shoutcast and 30 eggdrops... It got memory shortage. Is that suppose to be like that? I'm not sure how much memory an eggdrop or a shoutcast uses... Here is what my ps aux showed:

[root@t248 ~]# vzctl exec 104 ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 1504 512 ? Ss Apr08 0:00 ini
root 6126 0.0 0.0 1560 592 ? Ss Apr08 0:00 /sbin/syslogd
root 6134 0.0 0.1 3468 1520 ? Ss Apr08 0:01 /usr/sbin/sshd
nobody 7255 0.0 0.2 4068 2092 ? Ss Apr08 0:00 proftpd: (accepting connections)
daemon 7258 0.0 0.0 1684 628 ? Ss Apr08 0:00 /usr/sbin/atd
root 7261 0.0 0.0 1764 816 ? Ss Apr08 0:00 /usr/sbin/cron
ircd 7328 0.0 0.4 5936 4892 ? Ss Apr08 0:10 ./ircd
egg 11789 0.0 0.2 12376 2660 ? S Apr08 0:00 ./eggdrop-1.6.17 egg1.conf
bonan 20451 0.0 0.2 29740 2152 ? S Apr08 0:00 ./sc_serv
egg 27810 0.0 0.2 12376 2664 ? S Apr08 0:00 ./eggdrop -m eggdrop.conf
egg 27844 0.0 0.2 12376 2684 ? S Apr08 0:00 ./eggdrop -m eggdrop.conf
egg 14291 0.0 0.2 12376 2736 ? S Apr09 0:01 ./eggdrop -m v2sis.conf
egg 1421 0.0 0.2 12376 2740 ? S Apr09 0:00 ./eggdrop -m 01.conf
egg 1904 0.0 0.2 12376 2740 ? S Apr09 0:00 ./eggdrop -m 02.conf
egg 8083 0.0 0.2 12364 2632 ? S 01:47 0:00 ./eggdrop -m egg11.conf
egg 9346 0.0 0.2 12376 2720 ? S 02:00 0:00 ./eggdrop -m egg13.conf
egg 9806 0.0 0.2 12376 2664 ? S 02:05 0:00 ./eggdrop -m egg14.conf
egg 10096 0.0 0.2 12376 2736 ? S 02:28 0:00 ./eggdrop -m egg15.conf
egg 10099 0.0 0.2 12376 2740 ? S 02:28 0:00 ./eggdrop -m egg16.conf
egg 10102 0.0 0.2 12364 2716 ? S 02:29 0:00 ./eggdrop -m egg17.conf
egg 10105 0.0 0.2 12376 2748 ? S 02:29 0:00 ./eggdrop -m egg18.conf
egg 10223 0.0 0.2 12376 2740 ? S 02:30 0:00 ./eggdrop -m egg19.conf
egg 10232 0.0 0.2 12364 2712 ? S 02:32 0:00 ./eggdrop -m egg20.conf
egg 10235 0.0 0.2 12364 2716 ? S 02:32 0:00 ./eggdrop -m egg21.conf
egg 10239 0.0 0.2 12364 2716 ? S 02:33 0:00 ./eggdrop -m egg22.conf
egg 11268 0.0 0.2 12364 2712 ? S 02:35 0:00 ./eggdrop -m egg23.conf
egg 11302 0.0 0.2 12364 2716 ? S 02:35 0:00 ./eggdrop -m egg24.conf
egg 11311 0.0 0.2 12364 2716 ? S 02:37 0:00 ./eggdrop -m egg25.conf
egg 11342 0.0 0.2 12364 2712 ? S 02:39 0:00 ./eggdrop -m egg26.conf
egg 11408 0.0 0.2 12376 2740 ? S 02:40 0:00 ./eggdrop -m egg27.conf
egg 11424 0.0 0.2 12376 2740 ? S 02:42 0:00 ./eggdrop -m egg28.conf
egg 11428 0.0 0.2 12376 2740 ? S 02:43 0:00 ./eggdrop -m egg29.conf
egg 11431 0.0 0.2 12376 2728 ? S 02:44 0:00 ./eggdrop -m egg30.conf
egg 11465 0.0 0.2 12376 2732 ? S 02:45 0:00 ./eggdrop -m egg31.conf
egg 11470 0.0 0.2 12376 2732 ? S 02:46 0:00 ./eggdrop -m egg32.conf
egg 11473 0.0 0.2 12376 2736 ? S 02:46 0:00 ./eggdrop -m egg33.conf
egg 11482 0.0 0.2 12376 2740 ? S 02:47 0:00 ./eggdrop -m egg34.conf
egg 11485 0.0 0.2 12376 2732 ? S 02:47 0:00 ./eggdrop -m egg35.conf
egg 11488 0.0 0.2 12376 2732 ? S 02:48 0:00 ./eggdrop -m egg36.conf
egg 11491 0.0 0.2 12376 2736 ? S 02:48 0:00 ./eggdrop -m egg37.conf
egg 11494 0.0 0.2 12376 2616 ? S 02:49 0:00 ./eggdrop -m egg38.conf
egg 11497 0.0 0.2 12376 2740 ? S 02:49 0:00 ./eggdrop -m egg39.conf
egg 11563 0.0 0.2 12376 2736 ? S 02:53 0:00 ./eggdrop -m egg42.conf
root 2791 0.0 0.0 2492 840 ? Rs 20:43 0:00 ps aux

And here is the user_beancounters:

[root@t248 ~]# vzctl exec 104 cat /proc/user_beancounters
Version: 2.5
uid resource held maxheld barrier limit failcnt
104: kmemsize 2829599 3083390 5141514 8855665 0
lockedpages 0 0 836 836 0
privvmpages 90317 97727 95862 105448 81
shmpages 0 1632 9586 9586 0
dummy 0 0 0 0 0
numproc 82 90 800 800 0
physpages 10135 10804 0 2147483647 0
vmguarpages 0 0 15977 2147483647 0
oomguarpages 10135 10804 15977 2147483647 0
numtcpsock 116 122 800 800 0
numflock 2 8 668 734 0
numpty 0 2 80 80 0
numsiginfo 1 5 1024 1024 0
tcpsndbuf 93576 373564 2437038 5713838 0
tcprcvbuf 0 1021384 2437038 5713838 0
othersockbuf 80208 142592 1218519 4495319 0
dgramrcvbuf 0 12040 1218519 1218519 0
numothersock 72 101 800 800 0
dcachesize 204480 226064 3740085 3852288 0
numfile 1305 1358 6688 6688 0
dummy 0 0 0 0 0
dummy 0 0 0 0 0
dummy 0 0 0 0 0
numiptent 10 10 200 200 0
Re: Memory usage [message #2594 is a reply to message #2589] Mon, 10 April 2006 22:04 Go to previous messageGo to next message
eugeniopacheco is currently offline  eugeniopacheco
Messages: 40
Registered: November 2005
Member
Hello again,

I was reading the user manual for OpenVZ and I read that the Alloc Memory is a Virtual memory, so theoretically it shouldn't have a limitation right?

Let me rephrase that... I meant that the total shouldn't have a limit, right? I noticed that the privvmpages limits this Alloc limit... Currently my vzmemcheck shows the following:

[root@t248 ~]# vzmemcheck -Av
Output values in Mbytes
veid LowMem LowMem RAM MemSwap MemSwap Alloc Alloc Alloc
util commit util util commit util commit limit
101 2.49 34.33 62.55 62.55 96.74 212.12 96.74 368.11
102 0.25 24.79 7.15 7.15 87.20 8.57 87.20 436.70
104 2.89 24.79 42.45 42.45 87.20 355.48 87.20 436.70
105 0.21 24.79 2.21 2.21 87.20 3.05 87.20 436.70
------------------------------------------------------------ -------------
Summary: 5.84 108.71 114.36 114.36 358.35 579.21 358.35 1678.21
326.00 326.00 1001.00 1001.00 1001.00 1001.00 1001.00 1001.00
[root@t248 ~]# vzmemcheck -v
Output values in %
veid LowMem LowMem RAM MemSwap MemSwap Alloc Alloc Alloc
util commit util util commit util commit limit
101 0.76 10.50 6.25 6.25 9.66 21.19 9.66 36.77
102 0.08 7.58 0.71 0.71 8.71 0.86 8.71 43.62
104 0.89 7.58 4.24 4.24 8.71 35.51 8.71 43.62
105 0.06 7.58 0.22 0.22 8.71 0.30 8.71 43.62
------------------------------------------------------------ -------------
Summary: 1.79 33.25 11.42 11.42 35.80 57.86 35.80 167.64

The question is, is the 1001.00 the maximum that should be used? I mean, take a look at the vzmemcheck -Av, it shows that the sum is actually 1678,21, but it shows underneath that number, 1001,00. But the RAM is still unused... It's only using 114,36 MB of RAM, so I can make privvmpages larger, without problems, even though it sums over the 1001,00, right?

Regards, and again thanks for all your help;)
Re: Memory usage [message #2602 is a reply to message #2589] Tue, 11 April 2006 08:04 Go to previous messageGo to next message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

privvmpages is in pages Smile i.e. 4Kb units.
but you can set this settings in Kb or Mb in vzctl, using 'k' or 'm' suffix.

each eggdrop consumes ~3Mb of RAM and 12Mb of Virtual Space.
So I suppose everything is correct.


http://static.openvz.org/userbars/openvz-developer.png
Re: Memory usage [message #2606 is a reply to message #2468] Tue, 11 April 2006 11:53 Go to previous messageGo to next message
eugeniopacheco is currently offline  eugeniopacheco
Messages: 40
Registered: November 2005
Member
Hi,

Ok, I got it, but then is the virtual memory limited? I mean, does it have the same limit as the RAM?

For example... My machine has 1GB of RAM. If I advertise that my VDS has 128MB of RAM, should I limit it to 512MB of Virtual Memory? (I'm using the numbers you gave me, where the virtual space used by the eggdrop is 4 times the ram it consumes)
Can I run 7 VDS with 512MB limit of Virtual Memory and if they consume at the same time 512MB of virtual memory is my system going to get memory shortage? Notice that theoretically it would consume only 896MB of RAM (512 * 7 / 4)...

I just don't know where this Virtual Memory comes from... Smile Sorry for asking this and thanks for your help.

Regards,

Eugenio Pacheco
Re: Memory usage [message #2886 is a reply to message #2606] Tue, 25 April 2006 00:00 Go to previous message
eugeniopacheco is currently offline  eugeniopacheco
Messages: 40
Registered: November 2005
Member
Hi,

Can someone please tell me if the virtual memory (privvmpages) is limited to the amount of RAM memory in the computer?

When I type the command vzmemcheck, this is what shows up:

[root@t248 ~]# vzmemcheck
Output values in %
LowMem LowMem RAM MemSwap MemSwap Alloc Alloc Alloc
util commit util util commit util commit limit
1.44 25.67 20.96 20.96 27.09 79.90 27.09 145.31
[root@t248 ~]# vzmemcheck -A
Output values in Mbytes
LowMem LowMem RAM MemSwap MemSwap Alloc Alloc Alloc
util commit util util commit util commit limit
4.72 83.92 209.80 209.80 271.15 799.86 271.15 1454.60
326.00 326.00 1001.00 1001.00 1001.00 1001.00 1001.00 1001.00
[root@t248 ~]# vzmemcheck -Av
Output values in Mbytes
veid LowMem LowMem RAM MemSwap MemSwap Alloc Alloc Alloc
util commit util util commit util commit limit
101 2.55 34.33 94.67 94.67 96.74 244.85 96.74 368.11
102 1.32 24.79 62.10 62.10 87.20 498.63 87.20 649.79
105 0.97 24.79 53.14 53.14 87.20 56.50 87.20 436.70
------------------------------------------------------------ -------------
Summary: 4.84 83.92 209.91 209.91 271.15 799.98 271.15 1454.60
326.00 326.00 1001.00 1001.00 1001.00 1001.00 1001.00 1001.00
[root@t248 ~]# vzmemcheck -v
Output values in %
veid LowMem LowMem RAM MemSwap MemSwap Alloc Alloc Alloc
util commit util util commit util commit limit
101 0.78 10.50 9.46 9.46 9.66 24.46 9.66 36.77
102 0.40 7.58 6.20 6.20 8.71 49.81 8.71 64.91
105 0.29 7.58 5.31 5.31 8.71 5.64 8.71 43.62
------------------------------------------------------------ -------------
Summary: 1.47 25.67 20.96 20.96 27.09 79.91 27.09 145.31


The thing is. It seems to me that the RAM memory is underused... It shows that it's only 21% (210MB) used. The machine I'm running openvz has 1GB of memory. But, the Alloc memory is being overused, it shows that it's 145% used (1455MB). So, my question is, can I use the Alloc memory (privvmpages) to match up the RAM to be used? I just don't know where this virtual memory comes from or what resources it uses.

Please help?Smile

Eugenio Pacheco
Previous Topic: ovzkernel 2.6.16-026test009.1 and RHEL 4 update 3 problem
Next Topic: linux 2.6.8 compile error arch/i386/kernel/process.c
Goto Forum:
  


Current Time: Sun Jul 14 00:28:42 GMT 2024

Total time taken to generate the page: 0.02839 seconds