Reputation: 381
I'm trying to understand meaning of vCPU and CPU units and connection of these concepts to physical CPU.
I have ECS cluster with one cluster instance, which is m5ad.large EC2 instance.
Here is output of lscpu
command on this instance:
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Thread(s) per core: 2
Core(s) per socket: 1
Socket(s): 1
NUMA node(s): 1
Vendor ID: AuthenticAMD
CPU family: 23
Model: 1
Model name: AMD EPYC 7571
Stepping: 2
CPU MHz: 2892.092
BogoMIPS: 4399.83
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 64K
L2 cache: 512K
L3 cache: 8192K
NUMA node0 CPU(s): 0,1
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf tsc_known_freq pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch topoext vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 clzero xsaveerptr arat npt nrip_save
This instance has one processor (Socket(s): 1
), one core per socket and 2 threads per core, that's why actual number of threads is number of sockets * number of cores per socket * number of threads per core = 1 * 1 * 2 = 2
.
So, if I understand correct, this value is also a number of available vCPU, and vCPU is kernel thread.
As it said in ECS documentation, number of CPU units can be calculated as number of vCPU * 1024
. In this case, there are 2048 CPU units
My questions are what is CPU unit, why am I need to multiply on 1024 and what is physical connection between processor and CPU units?
Upvotes: 28
Views: 27829
Reputation: 1356
When running containers, CPU allocation is typically done using CPU units as described in the ECS documentation:
1024 CPU units corresponds to 1 vCPU.
In the task definition you can specify the CPU allocation using either CPU units (e.g. 1024) or as a vCPU string (e.g. 1 vCPU).
You don't have to convert to CPU units, ECS can do that for you. If you prefer to think of CPU allocation using vCPUs, that's fully supported.
Upvotes: 25