参见英文答案 >
Performance Issues with newFixedThreadPool vs newSingleThreadExecutor1
有什么区别 –
newSingleThreadExecutor vs newFixedThreadPool(20)
在操作系统和编程方面的观点.
每当我使用newSingleThreadExecutor运行我的程序,我的程序工作得很好,端到端延迟(第95百分位数)约5ms.
但是一旦我开始运行我的程序,
的newFixedThreadPool(20)
我的程序性能下降,我开始看到端到端的延迟为37ms.
那么现在我正在从架构的角度来理解这个线程是什么意思呢?并且如何决定什么是我应该选择的最佳线程数量?
如果我使用更多的线程,那会发生什么?
如果有人可以用外行语言向我解释这些简单的事情,那对我来说是非常有用的.谢谢您的帮助.
我的机器配置规范 – 我从Linux机器运行我的程序 –
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) cpu E5-2670 0 @ 2.60GHz
stepping : 7
cpu MHz : 2599.999
cache size : 20480 KB
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm arat pln pts
bogomips : 5199.99
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical,48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) cpu E5-2670 0 @ 2.60GHz
stepping : 7
cpu MHz : 2599.999
cache size : 20480 KB
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm arat pln pts
bogomips : 5199.99
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical,48 bits virtual
power management: