one loop thread
,耗时已经在微秒层面,更换服务器,从最多积压六万数据包,到几乎没有积压
在单线程循环处理数据的场景中,CPU的性能取决于主频、缓存大小、指令集架构等因素。一般来说,主频越高、缓存越大、指令集架构越先进的CPU在单线程处理数据时性能越好
单线程
性能提升,增加线程不是分必要的,梳理项目流程,确定耗时的点,单线程是否能满足需求,单线程考虑的东西更少,也不容易出问题。
上来就和就说加线程,多少有点毛病
事件
处理的都是行情数据,延迟敏感
吭哧吭哧加班一晚上,发布新的优化版本,本地剥离接口进行测试,速度也还行,tps:4.2万
部署到服务器,tps骤降:2.1万,回家尝试台式机,tps:7.9万,开始怀疑组内服务虚拟机多少有点问题,首先怀疑主频导致的,家用台式机和服务器CPU
,差异最大的地方就是主频
测试服务器A
processor : 7
vendor_id : GenuineIntel
cpu family : 6
model : 47
model name : Intel(R) Xeon(R) CPU E7- 4807 @ 1.87GHz
stepping : 2
microcode : 0x34
cpu MHz : 1866.733
cache size : 18432 KB
physical id : 1
siblings : 4
core id : 3
cpu cores : 4
apicid : 7
initial apicid : 7
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc cpuid aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm pti dtherm arat
bugs : clflush_monitor cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 3733.46
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
测试服务器B
processor : 7
vendor_id : GenuineIntel
cpu family : 6
model : 63
model name : Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz
stepping : 2
microcode : 0x3c
cpu MHz : 2599.998
cache size : 20480 KB
physical id : 14
siblings : 1
core id : 0
cpu cores : 1
apicid : 14
initial apicid : 14
fpu : yes
fpu_exception : yes
cpuid level : 15
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc cpuid aperfmperf pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cpuid_fault epb pti fsgsbase smep xsaveopt cqm_llc cqm_occup_llc dtherm ida arat pln pts
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 5199.99
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
咨询 OpenAI
首先是核心数和主频方面,Intel(R) Xeon(R) CPU E7- 4807 @ 1.87GHz拥有6个物理核心和12个逻辑核心,主频为1.87GHz;而Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz拥有8个物理核心和16个逻辑核心,主频为2.60GHz。因此,从核心数和主频方面来看,E5-2640 v3在单线程处理数据时应该比E7- 4807更具优势。
其次是缓存大小方面,E7- 4807的缓存大小为12MB,而E5-2640 v3的缓存大小为20MB。因此,E5-2640 v3拥有更大的缓存空间,可以提高数据的访问速度和缓存命中率。
最后是架构方面,E5-2640 v3采用了更先进的Haswell架构,而E7- 4807采用的是旧的Nehalem架构。Haswell架构相对于Nehalem架构在性能方面有所提升,这也可能对E5-2640 v3在单线程处理数据时的性能提升产生影响。
因此,综合考虑,在单线程循环处理数据的场景中,E5-2640 v3应该比E7- 4807具有更好的性能。但是,具体的性能差异会受到多种因素的影响,包括数据处理的算法、内存带宽、系统负载等等,需要具体问题具体分析。
硬件资料
Specification | Xeon E7-4807 (LGA1567) | Xeon E5-2640 v3 (LGA2011-v3) |
---|---|---|
Price | Search Online $78 - BUY | |
Socket Type | LGA1567 | LGA2011-v3 |
CPU Class | Server | Server |
Clockspeed | 1.9 GHz | 2.6 GHz |
Turbo Speed | Not Supported | Up to 3.4 GHz |
# of Physical Cores | 6 (Threads: 12) | 8 (Threads: 16) |
Cache | NA2 | NA2 |
Max TDP | 95W x 2 | 90W x 2 |
Yearly Running Cost | $34.68 | $32.85 |
Other | ||
First Seen on Chart | Q3 2020 | Q3 2014 |
# of Samples | 1 | 46 |
CPU Value | 69.1 | 225.6 |
Single Thread Rating | 721 (-59.2%) | 1767 (0.0%) |
CPU Mark | 6223 (-64.6%) | 17600 (0.0%) |