OpenVZ VSwap Memory Is it RAM or Hard Disk
I'm currently working with CentOS 6.4, and installing multiple virtual servers. The VSwap implementation is a little confusing to me. Does the swapping of VSwap happen in RAM or on the hard disk? :confused:
If it's on the RAM, then I should configure my memory not to over run the hardware amount available, right?
Lastly there was a discussion about that in the OpenVZ IRC channel and here's what I've picked up from it:
- OpenVZ vSwap is not like normal swap
- therefor it doesn't depend on the HW node swap size
but it is:
- happing in normal RAM
- like RAM allocation, but highly slowed down (so it's like swap from speed etc.)
Therefor yes, RAM + vSWAP of all containers should not be higher than total amount of memory (= totally no overselling).
However, always all RAM is used by all containers if needed and only limited if resources are busy. Same seems to apply for vSWAP - since it's located in memory, it cannot be used if all other containers use the total amount of their allocated RAM (if it fills HW total).
Don't take this as carved in stone - but I'm 90% sure I didn't get it that wrong :)
Hope this helps :)
Thank you Michel...
So that begs the question, "why would I use VSwap at all instead of allocating the memory that I want to use for that container?" I don't want the operation to be slow...
It seems I would be better off instead of doing:
Don't you think so?
This is pure speculation now, but what comes to mind:
- some apps require swap, otherwise they won't install (but this will not be the reason for implementing it)
- commercial aspect - doesn't it sound good if you get RAM + vSWAP rather than just RAM (must not be, but I think this could be since a lot of commercial vendors are "leading" the projects direction (Parallels))
But what about:
You have a total of 2GB Ram and create 2 VEs. Each gets 1GB Ram = no problems (but most hosting providers do oversell - it's only for them)
You give 1 VE 1GB and the other gets 1.5GB. Well, what happens if all memory is busy? e.g. 2.5GB RAM (500MB that is not available). It will lead to problems and I if the 1.5GB needs 1.5GB before the other, the 1st VE will only get 500MB.
But if you give 1GB each and 500MB swap for the 2nd VE - both will have the same amount if memory is full (swap will be ignored (that's what I'm not sure about, but as said, I thought it is like that). You won't have problems that way. However, if the one without swap only takes 500MB the 2nd one will have 1GB Ram + 500 swap.
Yeah, i don't know. I just don't know enough about VSwap, but you're probably right, it's better to have some. I'm going to dig into it, and see what else I can learn as soon as I finish server configurations. Then I'll do some fine tuning.
Might want to dig deeper on this.
And after using vzsplit, I found that RAM + vSWAP != TOTAL MEMORY
It looks to me like VSwap may be sharing the swap space between containers. If this is not the case, the only other conclusion I can come up with is that vspilt is very broken.
You can simply run the command on your hardware node, and see that the sum of just the VSwap memory exceeds the RAM in the system.
I'm sure you've seen this as well: http://openvz.org/VSwap but I noted these sentences:
"The sum of physpages.limit and swappages.limit limits the maximum amount of allocated memory which can be used by a container. When physpages limit is reached, memory pages belonging to the container are pushed out to so called virtual swap (vswap). The difference between normal swap and vswap is that with vswap no actual disk I/O usually occurs. Instead, a container is artificially slowed down, to emulate the effect of the real swapping. Actual swap out occurs only if there is a global memory shortage on the system."
"no actual disk I/O" -> it's in memory. And "Actual swap out occurs only if there is a global memory shortage on the system" let me still think that it actually is/should be = total memory amount...
hmm...we have something to kill hours with hehe :)
I did not read that yet, but I'm going to spend some time looking through it. Thanks for your reply.
Here is the result of running vzsplit on my hardware node, which has 32GB ram and 1.3TB disk space:
|All times are GMT +2. The time now is 17:23.|
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.