devilmaycry3351
Contributor
Contributor

Shares explanation

Jump to solution

Hi guys,

I have one question about shares, how it works? I understand that the scheduler use shares, when the resources on the host running low, and contention between vm's start.

But I see in the sildes of official course, examples with percentage and so on...and I don't understand very well.

Can clarify with an example?

Thank you very much!

0 Kudos
1 Solution

Accepted Solutions
scott28tt
VMware Employee
VMware Employee

My responses below assume each VM in their examples have 1 vCPU.

Consider the following examples. n Two CPU-bound virtual machines run on a host with 8GHz of aggregate CPU capacity. Their CPU shares are set to Normal and get 4GHz each.

VM1: "Normal" CPU shares (equal to 1000)

VM2: "Normal" CPU shares (equal to 1000)

So in this case 8Ghz (total amount of host)/2 (shares set to Normal) = 4Ghz, it's correct?

Yes, when VM1 and VM2 are in CPU contention with one another, they have an equal entitlement to be allocated CPU time.

There are 2000 total shares (VM1 + VM2) and each VM has 50% of those shares.

If they are the only 2 VMs running, changing both their CPU shares to "High" or both to "Low" would still mean they have an equal entitlement (50% of the total shares)

A third CPU-bound virtual machine is powered on. Its CPU shares value is set to High

VM1: "Normal" CPU shares (equal to 1000)

VM2: "Normal" CPU shares (equal to 1000)

VM3: "High" CPU shares (equal to 2000)

In this previous example I don't understand very well. Can help me to understand?

VM3 has twice the entitlement of VM1 and of VM2. VM1 and VM2 still have an equal entitlement against one another.

There are now 4000 total shares. VM1 has 25% of them, VM2 has 25% of them, VM3 has 50% of them. The same would be true if VM3 was "Normal" and both VM1 and VM2 were "Low".

In simple terms, shares are a RELATIVE allocation method, and only have any meaning at all when there is resource contention.


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog

View solution in original post

0 Kudos
3 Replies
scott28tt
VMware Employee
VMware Employee

This should help: https://docs.vmware.com/en/VMware-vSphere/6.7/vsphere-esxi-vcenter-server-67-resource-management-gui...


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos
devilmaycry3351
Contributor
Contributor

Hi scott! Thank you for your response!

I see in the guide you have mentioned this example :

High 2000 shares per virtual CPU 20 shares per megabyte of configured virtual machine memory.

Normal 1000 shares per virtual CPU 10 shares per megabyte of configured virtual machine memory.

Low 500 shares per virtual CPU 5 shares per megabyte of configured virtual machine memory

"The relative priority represented by each share changes when a new virtual machine is powered on. This affects all virtual machines in the same resource pool. All of the virtual machines have the same number of virtual CPUs. Consider the following examples. n Two CPU-bound virtual machines run on a host with 8GHz of aggregate CPU capacity. Their CPU shares are set to Normal and get 4GHz each."

In this case why 4ghz? It's because the default assignment of 4:2:1 (High,Normal,Low)?

So in this case 8Ghz (total amount of host)/2 (shares set to Normal) = 4Ghz, it's correct?

A third CPU-bound virtual machine is powered on. Its CPU shares value is set to High, which means it should have twice as many shares as the machines set to Normal. The new virtual machine receives 4GHz and the two other machines get only 2GHz each. The same result occurs if the user specifies a custom share value of 2000 for the third virtual machine.

In this previous example I don't understand very well. Can help me to understand?

Thanks.

Stefano

0 Kudos
scott28tt
VMware Employee
VMware Employee

My responses below assume each VM in their examples have 1 vCPU.

Consider the following examples. n Two CPU-bound virtual machines run on a host with 8GHz of aggregate CPU capacity. Their CPU shares are set to Normal and get 4GHz each.

VM1: "Normal" CPU shares (equal to 1000)

VM2: "Normal" CPU shares (equal to 1000)

So in this case 8Ghz (total amount of host)/2 (shares set to Normal) = 4Ghz, it's correct?

Yes, when VM1 and VM2 are in CPU contention with one another, they have an equal entitlement to be allocated CPU time.

There are 2000 total shares (VM1 + VM2) and each VM has 50% of those shares.

If they are the only 2 VMs running, changing both their CPU shares to "High" or both to "Low" would still mean they have an equal entitlement (50% of the total shares)

A third CPU-bound virtual machine is powered on. Its CPU shares value is set to High

VM1: "Normal" CPU shares (equal to 1000)

VM2: "Normal" CPU shares (equal to 1000)

VM3: "High" CPU shares (equal to 2000)

In this previous example I don't understand very well. Can help me to understand?

VM3 has twice the entitlement of VM1 and of VM2. VM1 and VM2 still have an equal entitlement against one another.

There are now 4000 total shares. VM1 has 25% of them, VM2 has 25% of them, VM3 has 50% of them. The same would be true if VM3 was "Normal" and both VM1 and VM2 were "Low".

In simple terms, shares are a RELATIVE allocation method, and only have any meaning at all when there is resource contention.


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos