Ask Your Question

vCPU vs Physical CPU

asked 2013-08-19 00:41:36 -0500

How does OpenStack/KVM set the number of vCPUs based on the physical CPU on the physical machine?

In my case, I have two different model of Intel CPU, Xeon E5645 and Xeon E5-2690 for my compute-node servers:

I checked Intel website, there is 6 cores in Xeon E5645 while Xeon E5-2690 has 8 cores.

In the 'compute_nodes' table, it shows that there are 12 vCPU for the machine with Xeon E5645; whereas there are 16 vCPU in Xeon E5-2690.

--> It seems that the ratio is 1:2

How does it calculate?

Can I adjust it?

edit retag flag offensive close merge delete


Please rephrase the title into a question.

Stenstad gravatar imageStenstad ( 2013-08-19 03:09:10 -0500 )edit

what do you suggest? I have no idea!

brucelok gravatar imagebrucelok ( 2013-08-19 03:23:37 -0500 )edit

3 answers

Sort by ยป oldest newest most voted

answered 2013-08-19 03:01:16 -0500

Stenstad gravatar image

updated 2013-08-19 03:06:18 -0500

vCPUs are calculated based on what is reported in /proc/cpuinfo. You have hyperthreading enabled, thus you have X physical CPUs * Y cores * 2.

From what I've read, enabling hyperthreading is recommended on compute nodes, so your numbers seem fine.

This presentation explains a bit about overbooking:

Also look at the "cpu_allocation_ration" option in nova.conf:

edit flag offensive delete link more


Thank you so much!

brucelok gravatar imagebrucelok ( 2013-08-19 03:11:01 -0500 )edit

answered 2018-06-20 06:34:41 -0500

chaman bharti gravatar image

You can print lscpu from the compute node, you will see below output as below:

[root@compute ~]# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                40
On-line CPU(s) list:   0-39
Thread(s) per core:    2
Core(s) per socket:    10
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel

So CPU(s): is the vCPUs in Openstack.

Formula for calculation is as follows:

vCPUs=`Thread(s) per core * Core(s) per socket * Socket(s)

ie. vCPUs=2*10*2

However overcommited vCPU will be calculated as following:

 "OverCommited vCPU" = vCPU*OverCommitmentRatio

ie "OverCommited vCPU" = 40*16= 640

edit flag offensive delete link more

answered 2015-02-09 11:53:16 -0500

nutshi gravatar image

thanks .. is not working

BTW here is a handy calculator for that

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2013-08-19 00:41:36 -0500

Seen: 18,496 times

Last updated: Jun 20 '18