我试图了解vCPU和CPU单元的含义以及这些概念与物理CPU的联系。
我有一个集群实例ECS集群,它是m5ad.large EC2实例。
这是此实例上lscpu
命令的输出:
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
此实例具有一个处理器(
Socket(s): 1
),每个套接字一个核心,每个核心2个线程,这就是为什么实际线程数是number of sockets * number of cores per socket * number of threads per core = 1 * 1 * 2 = 2
的原因。因此,如果我理解正确,那么该值也是可用vCPU的数量,并且vCPU是内核线程。
如ECS文档中所述,CPU单元数可以计算为
number of vCPU * 1024
。在这种情况下,有2048个CPU单元我的问题是什么是CPU单元,为什么我需要乘以1024,以及处理器和CPU单元之间的物理连接是什么?
最佳答案
运行容器时,通常使用ECS文档中所述的CPU单元完成CPU分配:
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#task_size
1024个CPU单位对应于1个vCPU。
在任务定义中,您可以使用CPU单元(例如1024)或作为vCPU字符串(例如1 vCPU)指定CPU分配。
您无需即可将转换为CPU单元,ECS可以为您完成此操作。如果您想考虑使用vCPU分配CPU,则完全支持。
关于amazon-web-services - 了解AWS ECS中的CPU单元,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59175035/