简体   繁体   English

线程测试之间的延迟:Linux 裸机与 VM 上的 QNX

[英]Latency between thread test: Linux bare metal machine vs QNX on a VM

I recently did a latency comparison on these two setups: a) Ubuntu 16.04 running on a 12 core host;我最近对这两种设置进行了延迟比较: a) Ubuntu 16.04 在 12 核主机上运行; b) A guest QNX running a VMware on a laptop host (4 cores assigned to the QNX VM) - I do not have a better setup currently for QNX. b) 在笔记本电脑主机上运行 VMware 的来宾 QNX(分配给 QNX VM 的 4 个内核)——我目前没有更好的 QNX 设置。

The test scenario: 10 threads running, each thread sends out a message to a randomly chosen receiving thread every 30ms-ish - very low message rate indeed;测试场景:运行 10 个线程,每个线程每 30ms-ish 向随机选择的接收线程发送一条消息 - 消息率确实非常低; the message mechanism is implemented using conditional variables and each thread has its own dedicated rx prod-consumer queue and its own conditional variable and mutex - so no interference between queues.消息机制是使用条件变量实现的,每个线程都有自己专用的 rx prod-consumer 队列和自己的条件变量和互斥体 - 因此队列之间没有干扰。 I measure the time between the message got constructed/sent and the receiving thread gets the message.我测量消息被构造/发送和接收线程获取消息之间的时间。 The mean and std_dev min max are all captured for each thread.均值和 std_dev min max 都为每个线程捕获。

The result is surprisingly favoring QNX (although it is running on a VM).结果令人惊讶地有利于 QNX(尽管它在 VM 上运行)。 10us vs 40us. 10us 对 40us。

for a thread on Linux (seconds): mean=0.000038076 std_dev=2.7523e-05 min=0.000000254 max=0.000177410 sampleSize=1023 for a thread QNX (seconds): mean=0.000011351 std_dev=0.000105937 min=0.000000000 max=0.000999987 sampleSize=969对于Linux(秒):平均值= 0.000038076 std_dev = 2.7523E-05-05 min = 0.000000254 max = 0.00017410 samplys = 1023 = 1023 = 1023 = 1023 = 1023 = 1023 = Qnx(secont Qnx),

I noticed that the QNX side the clock is not as precise (resolution wise) as the Linux side since I do see the min latency measurable is 0.我注意到 QNX 端的时钟不如 Linux 端那么精确(分辨率方面),因为我确实看到可测量的最小延迟为 0。

I just wonder if it conforms with other people's experiences - does Linux thread conditional wake-up take 40us in average?我只是想知道它是否符合其他人的经验 - Linux线程条件唤醒平均需要40us吗? Btw, if the QNX time precision is in 100us and Linux is in nanosec, does this diff impact stat?顺便说一句,如果 QNX 时间精度为 100us 且 Linux 为纳秒,那么这个差异会影响统计数据吗? Thanks.谢谢。

The latency test turns out to be more sensitive (in a different way) to the HW than what I previous thought.结果表明,延迟测试对硬件的敏感度(以不同的方式)比我之前想象的要高。 The newer 12 core CPU host has hyper thread enabled and it produces 40us latency numbers.较新的 12 核 CPU 主机启用了超线程,并产生 40us 延迟数。 I moved to a older 4 CPU with hyper thread disabled machine, the latency number drops to 15-16us.我搬到了一台旧的 4 CPU 并禁用了超线程的机器上,延迟数下降到 15-16us。 That is in the same ball park range as the QNX VM number.这与 QNX VM 编号在同一范围内。 I wish I could make the platform more aligned in the tests to get a more conclusive answer in the future.我希望我可以使平台在测试中更加一致,以便在将来获得更确凿的答案。

new Linux result: mean=0.000015819 std_dev=1.39205e-05 min=0.000000503 max=0.000117652 sampleSize=1528新 Linux 结果:平均值=0.000015819 std_dev=1.39205e-05 min=0.000000503 max=0.000117652 sampleSize=1528

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

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