22

Google's Machine types page states that:

For the n1 series of machine types, a virtual CPU is implemented as a single hardware hyper-thread on a 2.6 GHz Intel Xeon E5 (Sandy Bridge), 2.5 GHz Intel Xeon E5 v2 (Ivy Bridge)...etc

Assuming that a single physical CPU core with hyper-threading appears as two logical CPUs to an operating system, then if the n1-standard-2 machine that is described as 2 virtual CPUs and 7.5 GB of memory, then this essentially means 1 CPU core, right?

So if I'm trying to follow hardware recommendations for an InfluxDB instance that recommends 2 CPU cores, then I should aim for a Google Compute Engine machine that has 4vCPUs, correct?

gunit
  • 3,700
  • 4
  • 31
  • 42

5 Answers5

12

Typically when software tells you how many cores they need they don't take hyper-threading into account. Remember, AMD didn't even have that (Hyper-Threading) until very recently. So 2 cores means 2 vCPUs. Yes, a single HT CPU core shows up as 2 CPUs to the OS, but does NOT quite perform as 2 truly independent CPU cores.

pirhac
  • 887
  • 2
  • 8
  • 16
  • 7
    So then based on Google's explanation, 1vCPU (aka 1 thread of a HT CPU core) is approximately 1/2 the performance of 1 whole physical CPU core? – gunit Aug 30 '17 at 19:37
  • 3
    in other word, 2vcpu means 1 single physical core (with hyper threading) – user1844933 May 12 '19 at 20:59
4

That's correct, you should aim for a GCE machine-type that has 4vCPUs... When you're migrating from an on-premises world, you're used to physical cores which have hyperthreading. In GCP, these are called vCPUs or virtual CPUs. A vCPU is equivalent to one hyperthread core. Therefore, if you have a single-core hyperthreaded CPU on premises, that would essentially be two virtual CPUs to one physical core. So always keep that in mind as oftentimes people will immediately do a test. They'll say, "I have a four-cores physical machine and I'm going to run four cores in the cloud" and ask "why their performance isn't the same?!!!"

ttfreeman
  • 5,076
  • 4
  • 26
  • 33
0

if the n1-standard-2 machine that is described as 2 virtual CPUs and 7.5 GB of memory, then this essentially means 1 CPU core, right?

I believe, yes.

So if I'm trying to follow hardware recommendations for an InfluxDB instance that recommends 2 CPU cores, then I should aim for a Google Compute Engine machine that has 4vCPUs, correct?

I think, they means 2 physical cores regardless of hyper threading (HT) because the performance of HT is not a stable reference. But IMO, the recommendation should also contains speed of each physical core. If the software recommends 2 CPU cores, you need 4 vCPUs on GCP.

Xuan
  • 578
  • 6
  • 14
  • There is one thing I don't understand in the [GCP documentation](https://cloud.google.com/compute/docs/cpu-platforms): "On Intel Xeon processors, Intel Hyper-Threading Technology supports multiple app threads running on each physical processor core." – Xuan May 27 '20 at 09:27
  • According to this benchmark https://medium.com/data-design/destroying-the-myth-of-number-of-threads-number-of-physical-cores-762ad3919880, if we have 4 vCPUs, we should run only 4 threads at the same time. I am not sure if this is correct on Xeon, according to the GCP documentation mentioned above? – Xuan May 27 '20 at 09:36
0

https://cloud.google.com/compute/docs/cpu-platforms says:

On Compute Engine, each virtual CPU (vCPU) is implemented as a single hardware multithread on one of the available CPU processors. On Intel Xeon processors, Intel Hyper-Threading Technology supports multiple app threads running on each physical processor core. You configure your Compute Engine VM instances with one or more of these multithreads as vCPUs. The specific size and shape of your VM instance determines the number of its vCPUs.

Falko Menge
  • 788
  • 7
  • 16
-3

Long ago and far away, there was a 1 to 1 equivalence between a 'CPU' (such as what one sees in the output of "top"), a socket, a core, and a thread. (And "processor" and/or "chip" too if you like.)

So, many folks got into the habit of using two or more of those terms interchangeably. Particularly "CPU" and "core."

Then CPU designers started putting multiple cores on a single die/chip. So a "socket" or "processor" or "chip" was no longer a single core, but a "CPU" was still 1 to 1 with a "core." So, interchanging those two terms was still "ok."

Then CPU designers started putting multiple "threads" (eg hyperthreads) in a single core. The operating systems would present each hyperthread as a "CPU" so there was no longer a 1 to 1 correspondence between "CPU" and "thread" and "core."

And, different CPU families can have different numbers of threads per core.

But referring to "cores" when one means "CPUs" persists.

Rick Jones
  • 166
  • 4