AWS EC2: The number of cpu cores available on an instance
Asked Answered
A

1

18

I have recently set up an instance (m4.4xlarge).

when I execute 'lscpu' command, the output looks something like the following:

CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                16
On-line CPU(s) list:   0-15
Thread(s) per core:    2
Core(s) per socket:    8
CPU socket(s):         1
      .
      .
      .

Does this mean that only 8 cores can be utilized?

If so, what are the rest of CPUs for?

Another answered 2/12, 2015 at 3:14 Comment(0)
H
34

m4.4xlarge instances have 16 logical CPUs, so it looks like your EC2 instance is reporting it as having a single socket, with 1 physical CPU that has 8 cores. Each core can execute two threads simultaneously (Intel Hyperthreading technology) so each core is presented as 2 logical CPUs.

CPU(s):                16 <- logical CPUs (Threads per core * Cores per socket)
On-line CPU(s) list:   0-15
Thread(s) per core:    2  <- Each core has hyperthreading and presents
                             itself as two logical CPUs
Core(s) per socket:    8  <- Instance sees it has 8-core physical CPU per socket
CPU socket(s):         1  <- Instance sees it has 1 physical CPU
Humpage answered 2/12, 2015 at 3:38 Comment(4)
so can I safely assume that my instance has 16 logical CPUs with a single core for each and can handle 16 processes simultaneously?Another
@d.s You can assume it has 16 logical CPUs and that you can run 16 threads semi-simultaneously (hyperthreading isn't full thread-isolation and there are shared resources), but you can't make any assumptions about the underlying hardware, because it depends on how Amazon configures their hypervisors to allocate vCPU resources to the guests. Amazon's own documentation states Each vCPU is a hyperthread of an Intel Xeon core for M4, M3, C4, C3, R3, HS1, G2, I2, and D2. which is pretty hand-wavey.Humpage
Thanks for the detailed explanation. Really helpful!Another
@birryee As a side note, lscpu also prints Model name: Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz, which has 8 physical cores according to this.Another

© 2022 - 2024 — McMap. All rights reserved.