Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Subscribe to our newsletter

Advertise on LowEndTalk.com

Latest LowEndBox Offers

    OpenVZ and vSwap
    New on LowEndTalk? Please read our 'Community Rules' by clicking on it in the right menu!

    OpenVZ and vSwap

    So we know openvz doesn't have real swap and it uses vswap instead. My understanding of vswap is that it's just ram but slowed down ram to make it feel like swap.

    So my question is that if a host node have 16GB of ram, and have created 2 openvz containers each with 4GB of ram and 4GB of vswap. And say if both of these containers use all 4GB of ram and all 4GB of vswap, then does it mean that the host node will use all 16GB of ram? Or will the host node start swapping as well? If it's the latter, then will the host node swap the content of vswap or ram of the openvz containers? Would WHMCS or whatever provisioning program consider such a host node have free space or at its full capacity? (Aka will it provision more containers on that node or will it provision on a new one?) I'm assuming it would be considered as have extra space since total ram is 16GB with lots of swap and total used is only 12GB with 12GB of swap.

    And at this time, if an additional container is created on the same node with again 4GB of ram and 4GB of vswap, will the third container's 4GB "guaranteed" ram be using host node's ram or vswap?

    Comments

    • If your CT swaps and host node has free RAM, then it goes to the RAM, but it's slowed down. If the host node doesn't have any free RAM, then it starts swaping to swap.

      Thanked by 1TheOnlyDK
    • @Kupol said:
      If your CT swaps and host node has free RAM, then it goes to the RAM, but it's slowed down. If the host node doesn't have any free RAM, then it starts swaping to swap.

      So when there are only 2 CTs each with 4GB of ram and 4GB of swap completely used, then everything will be in host node's ram? And if I create a third CT with the same thing, then 16GB of the 24GB (ram + vswap) will be in ram and the rest will be swapping? And the content that are swapping, are they from vswap or from ram (aka selected randomly by the host node)?

    • TheOnlyDK said: So when there are only 2 CTs each with 4GB of ram and 4GB of swap completely used, then everything will be in host node's ram? And if I create a third CT with the same thing, then 16GB of the 24GB (ram + vswap) will be in ram and the rest will be swapping? And the content that are swapping, are they from vswap or from ram (aka selected randomly by the host node)?

      You have too many what-if's going on in your mind, you should get a cheap dedi and use trial and error. OpenVZ does things with memory you will not expect. And will you have any IO left if you max out the memory in the containers, this is probably a bigger concern you haven't put any thought into.

      Thanked by 1TheOnlyDK
      Hostigation High Resource Hosting - SolusVM KVM VPS / Proxmox OpenVZ VPS- Low Cost Comodo SSL Certificates
    • @miTgiB said:
      You have too many what-if's going on in your mind, you should get a cheap dedi and use trial and error. OpenVZ does things with memory you will not expect. And will you have any IO left if you max out the memory in the containers, this is probably a bigger concern you haven't put any thought into.

      I'm not trying to do anything in real life, just thought of this when I was having my morning coffee. Everything was thought in my brain, so everything is a huge IF. I'm assuming everything that way and just want to know what would happen in that case. That is we are ignoring the CPU, the disk space, disk I/O, or any other factors. In theory, what would happen.

    • TheOnlyDK said: In theory, what would happen.

      I would guess the kernel will start killing processes in the containers that are out of memory.

      Hostigation High Resource Hosting - SolusVM KVM VPS / Proxmox OpenVZ VPS- Low Cost Comodo SSL Certificates
    • @miTgiB said:
      I would guess the kernel will start killing processes in the containers that are out of memory.

      But why would that happen though? The CT is only using its allocated resources (ram and swap, etc).

    • TheOnlyDK said: But why would that happen though?

      Probably because real world use is not the same as a lab. I am just guessing what will happen, real world use you just don't see it, and if you do, you see the kernel killing processes as the container is spawning new tasks.

      Thanked by 1TheOnlyDK
      Hostigation High Resource Hosting - SolusVM KVM VPS / Proxmox OpenVZ VPS- Low Cost Comodo SSL Certificates
    • KupolKupol Member
      edited January 2016

      As @miTgiB said OOM killer will kill processes in CTs. If we ignore OOM killer, then the CTs would use all available RAM on the host node, 12GB of RAM would be used as their 'guaranteed' RAM and the rest of host RAM would be split between them for vswap. After filling up RAM the host node would start swaping depending on the swappiness level set.

      EDIT: Do not forget your host node needs RAM too, so most likely your system would start swaping at around 13GB of RAM used, this can be tuned via swappiness.

      Thanked by 1TheOnlyDK
    • So let's just ignore the OOM killer for another slight moment, would WHMCS consider such a node available for new CTs? Since technically there are still ram available on the host node that it can just pull from the vswap?

    • I have no clue about WHMCS as I've never used it before.

    • TheOnlyDK said: would WHMCS consider such a node available for new CTs

      Depends if this is SolusVM or Virtualizor or some other control panel, WHMCS can only provision via the API of other control panels. With SolusVM, you set the limits per node on the master, based on allowed memory and disk space to provision, Virtualizor is similar.

      Thanked by 1TheOnlyDK
      Hostigation High Resource Hosting - SolusVM KVM VPS / Proxmox OpenVZ VPS- Low Cost Comodo SSL Certificates
    Sign In or Register to comment.