简体   繁体   English

Linux 2.6.18上IPC延迟测试的非常有趣的结果

[英]very interesting result from latency test of IPC on Linux 2.6.18

I am doing a performance (latency) test on unix socket under linux 2.6.18, 我正在linux 2.6.18下对unix socket进行性能(延迟)测试,
a process A writes 1024 bytes to process B on each 10 ms, and the result shows average latency is 20 us with small standard deviation(2~3 us). 进程A每10毫秒写入1024个字节到进程B,结果显示平均延迟为20 us,标准偏差小(2~3 us)。

The test becomes interesting when I run some additional CPU-bound processes simultaneously with process A&B, these new process is very cache-friendly such as a busy loop of simple math calculation, but as a result which surprises me, the IPC latency suddenly goes down, become 15 us on average. 当我与进程A和B同时运行一些额外的CPU绑定进程时,测试变得有趣,这些新进程非常缓存,例如简单数学计算的繁忙循环,但结果让我感到惊讶,IPC延迟突然下降,平均成为15美元。

As far as I know, to improve interactivity the O(1) scheduler(2.6 prior to 2.6.23) rewards IO-bound process by some heuristic method, but this can't explain why the speed becomes faster even than the first case. 据我所知,为了提高交互性,O(1)调度程序(2.6.23之前的2.6)通过某种启发式方法奖励IO绑定进程,但这无法解释为什么速度甚至比第一种情况更快。

I have also considered that if the Linux do some special case of busy-loop when process A was rewarded, but it seems not by further test. 我还考虑过,如果Linux在进程A得到奖励时做了一些特殊的繁忙循环,但似乎没有进一步测试。

This really confuses me. 这真让我困惑。


my configuration: CPU: Intel(R) Xeon(R) CPU E5-2609 0 @ 2.40GHz with 10M L3 cache MEM: 32G OS: Linux 2.6.18-308.el5 SMP x86_64 我的配置:CPU:Intel(R)Xeon(R)CPU E5-2609 0 @ 2.40GHz,10M L3缓存MEM:32G OS:Linux 2.6.18-308.el5 SMP x86_64

I suspect that some power-saving feature of the hardware is at work here. 我怀疑硬件的某些省电功能在这里起作用。 A 10ms sleep is more than enough time for modern hardware to enter a low-power state. 10ms的睡眠时间足以让现代硬件进入低功耗状态。 When you're looking at things at the microsecond level, there is a real, measurable latency to come out of a power-saving state. 当您在微秒级别上查看事物时,从节能状态出来会有一个真实的,可测量的延迟。

My guess is that running the "busy" program in parallel prevents the hardware from entering a low power state. 我的猜测是并行运行“忙”程序可以防止硬件进入低功耗状态。 Standard things to try: 标准的尝试:

  • At the BIOS level, disable any and all power-saving features including C-states 在BIOS级别,禁用任何和所有节能功能,包括C状态
  • At the OS level, disable cpuspeed (or whatever frequency scaling program your distro uses) 在操作系统级别,禁用cpuspeed(或发行版使用的任何频率扩展程序)
  • Try booting with the "idle=poll" kernel parameter 尝试使用“idle = poll”内核参数启动

That last suggestion is especially important for Sandy Bridge CPUs (which is what you have), at least with RHEL/CentOS 5.x (which I'm guessing you're running). 最后一个建议对于Sandy Bridge CPU(这就是你所拥有的)尤为重要,至少对于RHEL / CentOS 5.x(我猜你正在运行)。 I found the Linux kernel would still override some BIOS settings. 我发现Linux内核仍会覆盖某些BIOS设置。 Other Linux kernel params that may help you: 其他可以帮助您的Linux内核参数:

  • intel_idle.max_state=0 intel_idle.max_state = 0
  • processor.max_cstate=0 processor.max_cstate = 0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM