Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Setting UBC parameters

66 bytes added, 10:44, 11 March 2008
m
Robot: Automated text replacement (-VPS +container)
To keep it simple as close to the original format, it is in the form of questions and answers.
=== Question: I want to know how much RAM is allocated to a particular VE. I ran cat /proc/user_beancounters from inside my VPS container and I have the following results below. But I am not sure how to interpret the results. ===
<code>
oomguarpages 59239 59367 125000 2147483647 0
</code>
The guarantee is vmguarpages barrier = 125000 pages. In any case, the VPS container will be able to allocate that size of memory. Well... in almost any case, with one exception...
...when the whole node is in out of memory situation. In that case, the guarantee is oomguarpages barrier (the same 125000 pages in this example). It means that no VPS container process will be killed if memory usage by the VPS container is less than 125000 * 4096 bytes. If it is more, some process can be killed, and failcounter of oomguarpages will be increased.
Maximum size of memory which can be allocated is defined by privvmpages (see my previous post).
You are a bit wrong here. Let me explain it more carefully.
vmguarpages barrier is a guarantee: in any case (except out-of-memory aka OOM) you will be able to allocate 125000 pages. Well, probably you will be able to allocate more, up to 750000 pages (and if you are cool high priority process, you will be able to allocate 825000 pages, but definitely not more). We don't say anything about RAM or SWAP here. These pages can be swapped by HWnode kernel if needed, and can live in RAM if possible. Frankly, you can't say "I want this VPS container to have X MB RAM and Y MB SWAP". There is no such parameter.
vmguarpages does not account anything, so its current usage always equals to zero.
oomguarpages parameter's 'current usage' field accounts total amount of RAM+SWAP used.
physpages parameter accounts total amount of RAM used by the VPS container (the memory shared between VPSes containeres is divided and accounted in physpages for all VPSes containeres which use it in equal fractions). It cannot be limited, it just shows the current situation.
Let's do some math here.
kmemsize current value: 5125208 bytes
the sum is 247869844 bytes. If this sum is more than oomguarpages barrier = 125000 pages = 512000000 bytes (it is not), some of the processes on the VPS container can be killed in case of OOM situation.
=== Question: Is there a way to know for a VPS container account holder (me) that a server has reached an OOM situation? ==='free' inside a VPS container will show memory statistics for the hardware node (total memory, used memory, total swap, used swap). It's OK for Linux system to use as much RAM as possible, so free memory size is going to be not more than a few megabytes.
=== Are you aware of a script that would run as a cron job and do the OOM math on a regular basis and email me if I've hit the red zone or maybe at 85-90%? ===
2,253
edits