VMware Cloud Community
devilmaycry3351
Contributor
Contributor
Jump to solution

Shares explanation

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
Jump to solution

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

5 Replies
scott28tt
VMware Employee
VMware Employee
Jump to solution

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
Jump to solution

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

scott28tt
VMware Employee
VMware Employee
Jump to solution

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
Joe-VMware1
Contributor
Contributor
Jump to solution

Hi Scott,

Thanks for the detailed response. I am trying to find some answer to share values for Resource Pool couldn't find one, maybe you can help.

 

For a resource pool high is 8000 shares, normal is 4000 shares and low is 2000 shares. Why these numbers are doubled compared to Resource Allocation of a VM? 

There is some document I found from VMWare the default share values are completely different, https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.resmgmt.doc/GUID-C0D2EFAE-1FE4-4867...

High 2000 shares per virtual CPU

Normal 1000 shares per virtual CPU

Low 500 shares per virtual CPU

Please clarify,

 

Thanks,

 

Joe Antony

 

0 Kudos
depping
Leadership
Leadership
Jump to solution

in-depth info can be found in this free ebook:

https://www.rubrik.com/lp/white-papers/clustering-deep-dive-ebook

0 Kudos