OpenVZ Forum


Home » General » Support » How to properly set memory limits
How to properly set memory limits [message #629] Thu, 29 December 2005 15:36 Go to next message
rsaylor is currently offline  rsaylor
Messages: 43
Registered: December 2005
Member
I am trying to set a VPS to use 128 MB RAM but not sure if this is the correct setting. My overall goal is to get WHM/cPanel to work. However, anytime I do something in shell like compile apache or goto secure more on WHM the system just looses it and WHM/cPanel does not work, get just a blank page.

vzctl set ID --vmguarpages=32768 --save

If my calculations are correct each integer equals 4 KB so the value above should equal 128 MB. Does anybody know if this is the proper way to set memory limits and usage? I have read the pdf docs pretty well but kinda confused on this area for memory.
Re: How to properly set memory limits [message #630 is a reply to message #629] Thu, 29 December 2005 17:51 Go to previous messageGo to next message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

check the last column in output of `cat /proc/user_beancounters`
this column contains number of resource rejects. if it is more than zero than you have a too much strong limit for this resource, so you can increase it via `vzctl set ...`


http://static.openvz.org/userbars/openvz-developer.png

[Updated on: Sat, 07 January 2006 13:20] by Moderator

Report message to a moderator

Re: How to properly set memory limits [message #631 is a reply to message #630] Thu, 29 December 2005 18:01 Go to previous messageGo to next message
rsaylor is currently offline  rsaylor
Messages: 43
Registered: December 2005
Member
  21652824: kmemsize        1842939    2463286    2457600    2621440         52
            lockedpages           0          8         32         32          0
            privvmpages       42222      53573      49152      53575       1209
            shmpages             91       1371       8192       8192          0
            dummy                 0          0          0          0          0
            numproc              50         65         65         65        219
            physpages         20670      35551          0 2147483647          0
            vmguarpages           0          0  444416384  444416384          0
            oomguarpages      20670      35551       6144 2147483647          0
            numtcpsock           23         38         80         80          0
            numflock              1          7        100        110          0
            numpty                0          3         16         16          0
            numsiginfo            0         32        256        256          0
            tcpsndbuf             0      69068     319488     524288          0
            tcprcvbuf             0     320700     319488     524288          1
            othersockbuf      11140      53036     132096     336896          0
            dgramrcvbuf           0     128280     132096     132096        850
            numothersock         11         37         80         80          0
            dcachesize       163590     249690     524288     548864          0
            numfile             712        948       1280       1280          0
            dummy                 0          0          0          0          0
            dummy                 0          0          0          0          0
            dummy                 0          0          0          0          0
            numiptent             0          0        128        128          0


So it looks like I just need to increase kmemsize, privvmpages, numproc, tcprcvbuf and dgramrcvbuf

[Updated on: Sat, 07 January 2006 13:20] by Moderator

Report message to a moderator

Re: How to properly set memory limits [message #632 is a reply to message #631] Thu, 29 December 2005 18:04 Go to previous messageGo to next message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

yep!
CPanel is quite greedy while default VPS config is for moderate applications like simple web server with apache...
You can do the followin to setup these limits correctly.
Set it to some high value so that everything works.
After some time (when VPS was loaded in real life) you can observer how much resources was in used in peaks (maxheld column). Maxheld will give you some understanding of what resources your VPS need, so you can setup say maxhed + 20% for it to work in future.


http://static.openvz.org/userbars/openvz-developer.png
Re: How to properly set memory limits [message #633 is a reply to message #629] Thu, 29 December 2005 18:21 Go to previous messageGo to next message
rsaylor is currently offline  rsaylor
Messages: 43
Registered: December 2005
Member
Thanks, it works great now. Here are the values I used hopefully this will help others who want to run cPanel.

vzctl set 21652824 --vmguarpages=32768 --save
vzctl set 21652824 --kmemsize=6400000 --save
vzctl set 21652824 --privvmpages=80000 --save
vzctl set 21652824 --numproc=350 --save
vzctl set 21652824 --tcprcvbuf=540000 --save
vzctl set 21652824 --dgramrcvbuf=150000 --save

where 21652824 is the VPS ID
Re: How to properly set memory limits [message #719 is a reply to message #633] Sat, 07 January 2006 13:30 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

What you've done is a bit incorrect. See, there is a barrier and a limit for each resource -- for some resources like kmemsize barrier is not equal to limit, so you should scale them up accordingly.

In your particular case, you should have used something like this (I have taken all the parameter's values from /proc/user_beancounters output you have have provided and doubled all the values):

vzctl set NNN \
  --kmemsize 4915200:5242880 \
  --privvmpages 98304:107150 \
  --numproc 130 \
  --tcprcvbuf 638976:1048576 \
  --dgramrcvbuf 264192 \
  --save


And the next very important thing to do is to validate the resulting configuration, to make sure it is consistent:
$ /usr/sbin/vzcfgvalidate /etc/sysconfig/vz-scripts/NNN.conf
Validation completed: success


If configuration is not valid, you'll get the suggestions of how to fix it.


Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png

[Updated on: Sat, 07 January 2006 13:31]

Report message to a moderator

Re: How to properly set memory limits [message #743 is a reply to message #629] Sun, 08 January 2006 18:15 Go to previous message
rsaylor is currently offline  rsaylor
Messages: 43
Registered: December 2005
Member
Ok, I have altered my mem config a little. With this test below I do not get any conflicts anymore.

vzctl set 134148 --kmemsize 4915200:5242880 --privvmpages 98304:107150 --vmguarpages 98304:2147483647 --numproc 130 --tcprcvbuf 638976:1048576 --dgramrcvbuf 264192 --save

WHERE 134148 is the VPSID
Previous Topic: what sripts runs when you vzctl into a ve?
Next Topic: Hybodus OpenVZ Template :)
Goto Forum:
  


Current Time: Thu Mar 28 23:12:21 GMT 2024

Total time taken to generate the page: 0.02011 seconds