Memory guarantee is a new feature for Virtuozzo Containers. Now you can guarantee your customers that their containers will have the set minimal amount of RAM.
Memory guarantees enable you to control the overcommitment ratio in your datacenter. For example, if you need an overcommitment ratio of 2:1, set the memory guarantees of all containers and VMs to 50%.
Efficient overcommitment allows you to lower your datacenter costs and keep prices competitive. Customers usually do not use all of their purchased resources, and our predictive algorithm provides these resources to customers at once. To customers that do need all of their purchased resources all the time, you can offer containers with memory guarantees set to 100%, that is without overcommitment.
- For this example, make sure all other containers or virtual machines on the host are stopped.
-
Create two containers as follows:
# prlctl create myct --vmtype ct # prlctl create workload --vmtype ct
-
Set memory sizes for the containers. The workload is meant to have nearly as much RAM as your host has. For example, host RAM minus 2GB.
# prlctl set myct --memsize 3G # prlctl set workload --memsize <host_RAM_minus_2GB>
-
Set the memory guarantees for the containers:
# prlctl set myct --memguarantee 100 # prlctl set workload --memguarantee auto
-
Start the workload container:
# prlctl start workload -
Try to start
myct:# prlctl start myctIt should start successfully, because
workloadhas no workload inside or any reserved memory (as the default guarantee is 0%). -
Stop
myctand change the memory guarantee forworkload:# prlctl stop myct # prlctl set workload --memguarantee 100
-
Try to start
myctagain:# prlctl start myctIt should not start. The reason is
workloadis guaranteed all of its configured memory now (host RAM minus 1GB), andmyctis guaranteed 3GB, so the sum of guarantees exceeds host physical RAM.
To start myct, you will need to stop workload first. To start both containers, you will need to adjust their guarantees so that their total does not exceed host physical RAM.