Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am facing a memory overflow issue in one of my OpenVZ containers. While doing a vzctl enter 172 it gave an unable to allocate memory error. The container is supposed to be configured for 3.5GB of memory.

The container configuration is as follows:

file: /etc/vz/conf/172.conf

ONBOOT="yes"
NAMESERVER="4.2.2.1"
CPUUNITS="1000"
CPUS="2"
CPULIMIT="80"
PRIVVMPAGES="914432:914432"
DISKSPACE="153600000:153600000"
QUOTATIME="0"
KMEMSIZE="86236200:88740984"
LOCKEDPAGES="256:256"
SHMPAGES="21504:21504"
NUMPROC="2000:2000"
PHYSPAGES="0:9223372036854775807"
VMGUARPAGES="524288:2147483647"
OOMGUARPAGES="26112:9223372036854775807"
NUMTCPSOCK="360:360"
NUMFLOCK="380:420"
NUMPTY="16:16"
NUMSIGINFO="256:256"
TCPSNDBUF="10321920:16220160"
TCPRCVBUF="1720320:2703360"
OTHERSOCKBUF="4504320:16777216"
DGRAMRCVBUF="262144:262144"
NUMOTHERSOCK="5000:5000"
DCACHESIZE="3409920:3624960"
NUMFILE="18624:18624"
AVNUMPROC="180:180"
NUMIPTENT="128:128"
DISKINODES="200000:220000"
VE_ROOT="/srv/vz/root/$VEID"
VE_PRIVATE="/srv/vz/private/$VEID"
OSTEMPLATE="ubuntu-10.04-minimal_10.04_amd64"
ORIGIN_SAMPLE="vps.2048"
HOSTNAME="host.xyz.com"
IP_ADDRESS="xx.xx.xx.xx"

Output for cat /proc/user_beancounters

Version: 2.5
       uid  resource                     held              maxheld              barrier                limit              failcnt
      172:  kmemsize                 27229970             38669893             86236200             88740984                    0
            lockedpages                     0                    0                  256                  256                    0
            privvmpages                342879               396207               914432               914432                    0
            shmpages                     3987                11152                21504                21504                    0
            dummy                           0                    0                    0                    0                    0
            numproc                        96                  109                 2000                 2000                    0
            physpages                  211758               242535                    0  9223372036854775807                    0
            vmguarpages                     0                    0               524288           2147483647                    0
            oomguarpages               211758               242535                26112  9223372036854775807                    0
            numtcpsock                     30                   47                  360                  360                    0
            numflock                      122                  125                  380                  420                    0
            numpty                          1                    1                   16                   16                    0
            numsiginfo                      0                    3                  256                  256                    0
            tcpsndbuf                  692360              3389144             10321920             16220160                    0
            tcprcvbuf                  210744               283744              1720320              2703360                    0
            othersockbuf               240448               564608              4504320             16777216                    0
            dgramrcvbuf                     0                 8224               262144               262144                    0
            numothersock                  167                  180                 5000                 5000                    0
            dcachesize                1052759              1122245              3409920              3624960                    0
            numfile                      3700                 3939                18624                18624                    0
            dummy                           0                    0                    0                    0                    0
            dummy                           0                    0                    0                    0                    0
            dummy                           0                    0                    0                    0                    0
            numiptent                      10                   10                  128                  128                    0

Any help in finding the issue in the configuration would be extremely helpful.

Thanks

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Are you seeing failcounts as @Jonathan Ross mentioned? Have you restarted the container?

You need to run the consistency check:

cd /etc/vz/conf
vzcfgvalidate 101.conf

If it finds resource problems this tool can also fix them for you:

vzcfgvalidate -r 101.conf

http://wiki.openvz.org/UBC_consistency_check

share|improve this answer
    
I have added the output cat /proc/user_beancounters –  GeekTantra Apr 8 '11 at 13:54
    
It does not have failcounts. They get cleared after you restart the containers. Your conf file looks ok by eye. What does vzcfgvalidate tell you? –  Aleksandr Levchuk Apr 8 '11 at 14:00
    
Error: limit should be = 9223372036854775807 for vmguarpages (currently, 2147483647) set to 9223372036854775807 Warning: dcachesize.lim should be > 7151616 (currently, 3624960) set to 7151616 Error: othersockbuf.lim-othersockbuf.bar should be > 12800000 (currently, 16777216-4504320=12272896) set to 4504320:17304320 Validation completed: success –  GeekTantra Apr 8 '11 at 14:17
    
The above is the output for vzcfgvalidate -r /etc/vz/conf/172.conf –  GeekTantra Apr 8 '11 at 14:17
    
Yes, you had some serious issues there. It should be repaired now. You're config was modified. –  Aleksandr Levchuk Apr 8 '11 at 23:33

How much memory is on the host, is there actually 3.5GB of RAM spare ? Does it run with less than that (512MB for example) ?

cat /proc/user_beancounters will show you which resources are being exhausted if it's been running in the past. Look for fail counts on the right.

To give you an idea of tweaking resources if you haven't done so, one parameter I used to fix poor resource allocation with was:

vzctl set 101 --kmemsize $((11055923*2)):$((11377049*2)) --save

More on this on the OpenVZ Wiki

share|improve this answer
    
The Host Server has 8 GB of Memory and only 2 VMs of 3 GB and 3.5 GB RAM each. –  GeekTantra Apr 8 '11 at 10:25
    
The KMEMSIZE as shown in the conf file is set to 86236200:88740984 –  GeekTantra Apr 8 '11 at 10:28
    
This is all I could find unfortunately: http://www.linux.com/archive/feature/114214. Maybe someone else can chip in too. –  Jonathan Ross Apr 8 '11 at 10:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.