Tuesday, August 16, 2011

How to change the values of numproc and privvmpages

Advertisements

You may get memory over consume errors in openvz vps'. Error can be fork error. For Eg:
fork : unable to fork new process

You can confirm the error is because of memory overconsumption by checking the following command.

root@cpanel [/]# cat /proc/user_beancounters
Version: 2.5
       uid  resource        held            maxheld          barrier           limit                                                   failcnt
      101:  kmemsize   21335253   359571636   9223372036854775807  9223372036854775807   0
            lockedpages     0                   10              4925440              4925440                                     0
            privvmpages   235064           7784716             10000000             10000000                45752
            shmpages       24                 1320  9223372036854775807  9223372036854775807            0
            dummy            0                    0                    0                    0                                                   0
            numproc         98                 1500                 4096                 5120                            1992344
            physpages     123667              4965574                    0  9223372036854775807                    0
            vmguarpages          0                    0              9820160  9223372036854775807                    0
            oomguarpages   23668            4969178              9820160  9223372036854775807             0
            numtcpsock     260              3726  9223372036854775807  9223372036854775807            0
            numflock      7                  182  9223372036854775807  9223372036854775807                 0
            numpty               1                    2                  255                  255                                          0
            numsiginfo              0                 1024                 1500                 2000                               905
            tcpsndbuf      13916424   119625936  9223372036854775807  9223372036854775807        0
            tcprcvbuf      4297032             61066072  9223372036854775807 223372036854775807      0
            othersockbuf    120688     5234368  9223372036854775807  9223372036854775807           0
            dgramrcvbuf     0     13080  9223372036854775807  9223372036854775807                    0
            numothersock   104     1519  9223372036854775807  9223372036854775807                    0
            dcachesize    2743654        16510107  9223372036854775807  9223372036854775807         0
            numfile   7077                72257  9223372036854775807  9223372036854775807                    0
            dummy                           0                    0                    0                    0                    0
            dummy                           0                    0                    0                    0                    0
            dummy                           0                    0                    0                    0                    0
            numiptent                   43                   43  9223372036854775807  9223372036854775807      0
root@cpanel [/]#

uid 101 means the veid of the vps. 
The main parameters are explained below:

held - how many kernel level threads you are using at the time you cat the file
maxheld - how many is the maximum number of kernel level threads you have had
barrier - guaranteed amount of resources your vps is allocated
limit - physical limit your vps can consume
failcnt - also known as fail count or the number of times your vps has hit the specified limit

You can increase the value of these parameters by editing the configuration file of the vps on the node server. 
# vi /etc/vz/conf/101.conf

#NUMPROC="1500:1800"
NUMPROC="4096:5120"

#PRIVVMPAGES="7772160:7784660"
PRIVVMPAGES="10000000:10000000"

#NUMSIGINFO="1024:1024"
NUMSIGINFO="1500:2000"

Restart the vps after that. 
# vzctl restart 101

No comments:

Post a Comment

Be nice. That's all.