|
|
|
Re: Calculating kmemsize [message #36795 is a reply to message #36787] |
Mon, 20 July 2009 12:19 |
spectator
Messages: 6 Registered: July 2009
|
Junior Member |
|
|
> what does it mean "to calculate kmemsize"?
I'm trying to work out how to obtain the value of kmemsize in the examples of the OpenVZ wiki.
> Do you want to calculate kmemsize before VE is created?
Yes, I do. For two reasons. 1) To ensure my understanding of the examples is correct and also so that I can create containers of varying sizes on the same node.
It looks like my understanding of kmemsize is wrong then.
Looking at the consistency check page on the OpenVZ wiki, I see the first equation states that kmemsize needs to be at least a certain size but I can't come to a value of 16,384,000 for kmemsize.
Here are the values I'm using:
total mem 248MB
kernel mem 42304KB
user mem 200MB
avnumproc 200
numproc 400
numtcpsock 500
numothersock 500
vmguarpages 102400
kmemsize 16,384,000 / 18,022,400
tcpsndbuf 5,365,760 / 10,485,760
tcprcvbuf 5,365,760 / 10,485,760
othersockbuf 1,503,232 / 4,063,232
dgramrcvbuf 262144
oomguarpages 102400
lockedpages 4096
shmpages 131072
privvmpages 262,144 / 292,912
numfile 8192
numflock 200 / 220
numpty 64
numsiginfo 512
dcachesize 4,194,304 / 4,317,184
When using the equation to calculate the minimum for kmemsize, I always get a smaller value than the examples.
Are the examples wrong?
[Updated on: Mon, 20 July 2009 12:25] Report message to a moderator
|
|
|
|
Re: Calculating kmemsize [message #36797 is a reply to message #36796] |
Mon, 20 July 2009 12:39 |
spectator
Messages: 6 Registered: July 2009
|
Junior Member |
|
|
There is no contradiction - it's more likely my understanding is wrong.
> 16,384,00 >= $YOUR_KMEMSIZE >= $FORMULA_VALUE
I currently get the value, 16,384,000 from the example page but have no idea how this number comes about. How do I get $YOUR_KMEMSIZE or $FORMULA_VALUE (I realise these are example variables)?
Or is it perhaps that I need to create a container then that GIVES me the value of kmemsize so kmemsize isn't calculated at all but is dependent on all the other variables of the system?
If so which variables combine to give kmemsize?
[Updated on: Mon, 20 July 2009 12:40] Report message to a moderator
|
|
|
Re: Calculating kmemsize [message #36798 is a reply to message #36796] |
Mon, 20 July 2009 12:57 |
spectator
Messages: 6 Registered: July 2009
|
Junior Member |
|
|
For example, if I use figures from the OpenVZ example:
avnumproc = 200
datacachesize = 4,194,304
Using the consistency check formula:
kmemsize >= 40960 * avnumproc + datacachesize
Gives us: 12,386,304 not 16,384,000, as listed in the example.
I'm short 3,997,696 bytes.
|
|
|
|
|
|
Re: Calculating kmemsize [message #37320 is a reply to message #36842] |
Wed, 02 September 2009 18:17 |
damswf
Messages: 5 Registered: September 2009
|
Junior Member |
|
|
I agree, I just installed a web serveur in an openvz container, and i frequently have this problem. Either I can't do ps anymore, or i don't have a shell when I ssh, etc... instead I got "fork: Cannot allocate memory".
This is a pain for me since I wanted openvz to be more protected against hardware problems, and I have this headache instead.
Every time I grow up the kmemsize barrier limit, I see the maxheld increasing until behing greater to the barrier limit then I got some failcnt and errors.
This server is not at all under load now, but once it will be, it will be because of a lot of customers hitting the site (I cannot reproduce the same thing myself to test), and I cannot take the risk to have databases crashing nor losing data because of being unable to allocate kernel memory on a 8GB 64bits system (vc have 4GB).
And I have no clue what the values should be! I have kmemsize >= 40kB * avnumproc + dcache size but still the problem.
This is a serious issue for production servers.
So what do I do? I explain to my boss I just virtualized our servers and we have more problems although I explained him a few times ago that it will work better?
|
|
|
Re: Calculating kmemsize [message #37338 is a reply to message #37320] |
Thu, 03 September 2009 13:34 |
dragos2
Messages: 15 Registered: August 2009
|
Junior Member |
|
|
damswf wrote on Wed, 02 September 2009 21:17 | I agree, I just installed a web serveur in an openvz container, and i frequently have this problem. Either I can't do ps anymore, or i don't have a shell when I ssh, etc... instead I got "fork: Cannot allocate memory".
This is a pain for me since I wanted openvz to be more protected against hardware problems, and I have this headache instead.
Every time I grow up the kmemsize barrier limit, I see the maxheld increasing until behing greater to the barrier limit then I got some failcnt and errors.
This server is not at all under load now, but once it will be, it will be because of a lot of customers hitting the site (I cannot reproduce the same thing myself to test), and I cannot take the risk to have databases crashing nor losing data because of being unable to allocate kernel memory on a 8GB 64bits system (vc have 4GB).
And I have no clue what the values should be! I have kmemsize >= 40kB * avnumproc + dcache size but still the problem.
This is a serious issue for production servers.
So what do I do? I explain to my boss I just virtualized our servers and we have more problems although I explained him a few times ago that it will work better?
|
You can try other virtualization types like Citrix FreeXenServer
or even the opensource Xen(I don't have experience using Vmware
ESX).
But using OpenVZ as a webserver in full load I think the main things to consider are:
1) number of processes and files opened
openvz parameter for processes number 66535 is a huge number
also the number of open file descriptors should be at least
twice the threads your webserver spawns
2) tcp/ip buffers size, number of sockets. Pay attention to these both on HN and as new container parameters. Be sure
to reuse them fast
3) cpu power if you make use of cgi, fcgi etc.
The upper values should be configured both on HN and in
containers too.
If you set them only on one side, like only in HN or only
in container you won't gain anything.
This was from my little experience.
I hope it helps.
|
|
|