Up to now, we talked about mechanisms for virtualizing the memory resource.
In particular for dealing with dynamic
memory pressure and sharing machine pages across
VM's. A higher level issue is the policies we have to use for
allocating and reclaiming memory from the domains to which we've allocated them
in the first place. Ultimately, the goal of virtualization is maximizing the
utilization of the resources. Memory is
a precious resource. Virtualized environments may use
different policies for memory allocation. One can be a pure share
based policy. The idea here is, you pay less, you get less. That's the idea.
So if you have a service level agreement with
the data center, then the data center gives you a
certain amount of resources based on, the more of dollars
you put on a table. So that is a pure
share based approach. The problem with a share based approach,
is of course the fact that it could lead to
hoarding. If a virtual machine gets a bunch of resources
and it's not really using it, it's just wasting it.
Now, the desired behavior is if the working-set
of a virtual machine goes up, you give it
more memory. If it's working-set shrinks, get back
the memory so that you can give it to
somebody else. So working-set-based approach would be the
saner approach. But at the same time, if I
paid money, I need my resources. So, one thing that can be done is sort of put
these two ideas together in implementing a dynamic idle-adjusted
shares approach. In other words, you're going to tax
the guys that are hoarders, so you tax the
idle pages more than active pages. If I've given you
a bunch of resources, if you're actively using it,
more power to you. But if you're hoarding it,
I'm going to tax you. I'm going to take away the
resources that I gave you. And you may not even
notice it because you're not using it anyway.
So that's the idea in this dynamic idle-adjusted
shares approach. And now what is this tax? Well, we could make the tax rate 0%,
that is plutocracy, meaning you paid for it, you got it, you can sit on it,
I'm not going to tax you, that's one approach.
Or, I could make the tax 100%, meaning that
if you've got some resources and you're not
using it, I'm going to take all of it away.
[LAUGH] So that's the wealth redistribution. Sort of
a socialistic policy, use it or lose it. And
in other words, if you make the tax
100%, we are ignoring shares altogether. Now something in
between is probably the best way to do it, so for instance if you use a tax rate
of 50% or 75% saying if you have idle pages, then the tax rate is 50%, there's
a 50% chance I'll take it away. And that's what is being done in
the VMware ESX server today in terms of
how to allocate memory to the domains that
need it. You are going to use share based
approach, but if you're not actively using it,
we're going to take it away from you. And of course we'll give it back to you if
you start using it, and that's the reason why
you don't want to make the tax 100%, but
have it somewhat smaller. So by having a tax
rate that is not quite 100% but maybe 50%
or 75%, we can reclaim most of the idle
memory from the VM's that are not actively using it.
But at the same time, since we're not taxing idle pages 100%, it allows
for sudden working set increases that might
be experienced by a particular domain. Suddenly, a
domain starts needing more memory, at that point it may still have some reserves
in terms of the idle pages that I did not take away from that particular domain.
So the key point is that, you don't want to tax
at 100% because this allows for sudden working set increases
that may be there, in a virtual machine that happens
to be idle for some time, but suddenly work picks up.