Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Containers/Guarantees for resources

258 bytes added, 12:43, 23 May 2011
m
Protected "Containers/Guarantees for resources" ([edit=autoconfirmed] (indefinite) [move=autoconfirmed] (indefinite))
[[Category:UBC]]
[[Category:Containers]]
This page describes how guarantees for resources can be implemented.
= How to guarantee a guarantee =
It's not obvious at the first glance, but ''there are only two ways of how a guarantee can be provided'':# reserving reserve desired amount in advance# limiting limit consumers to keep some amount free
The first way has the followong disadvantages:
; reserving Reservation is impossible for certain resources: such resources as CPU time, disk or network bandwidth and similar can not be just reserved as theirs their amount instatntly instantly increases;
; reserving Reserved amount is essentially a limit, but much more strict: cutting off X megabytes from RAM implies that all the rest groups are limited in theirs their RAM consumption;
; reserving Reservation reduces containers density on the node: if one wants to run some identical containers , each requiring 100Mb on 1Gb system , reservations can be done for only 10 only containers, and starting the 11th becomes is impossible.
On the other hand , ''limiting'' of containers can provide guarantees for them as well.
= Providing a guarantee through limiting =
<center><math>
A L = G\;
</math></center>
<center><math>
L = A^{-1}G\;
</math></center>
Skipping boring calculations, the reverse matrix <math>A^{-1}\;</math> is
<center><math>
{
int sum;
int i;
 
if (N == 1) {
l[0] = R;
return;
}
sum = 0;
for (i = 0; i < N; i++)
sum += R - g[i];
for (i = 0; i < N; i++)
l[i] = (sum - (R - g[i]) - (N - 2) * (R - g[i]))/(N - 1);
}
</pre>
 
== Disadvantages of this approach ==
 
This approach has only one disadvantage: O(n) time needed to start a new container.