简体   繁体   English

在Linux上通过UDP进行延迟测量

[英]Latency measurement over UDP on Linux

I want to measure UDP latency and drop rate between two machines on Linux. 我想测量Linux上两台计算机之间的UDP延迟和丢失率。 Preferably (but not crucial) to perform measurement between multiple machines at the same time. 最好(但不是很关键)在多个机器之间同时执行测量。

As a result I want to get a histogram, eg RTT times of each individual packet at every moment during measurement. 结果,我想获得一个直方图,例如在测量期间的每个时刻每个单独数据包的RTT时间。 Expected frequency is about 10 packets per second. 预期的频率约为每秒10个数据包。

Do you know of any tool that I can use for this purpose? 您知道我可以用于此目的的任何工具吗?

What I tried so far is: 到目前为止,我尝试过的是:

  1. ping - uses icmp instead of UDP ping-使用icmp代替UDP
  2. iperf - measures only jitter but not latency. iperf-仅测量抖动,而不测量延迟。
  3. D-ITG - measures per flow statistics, no histograms D-ITG-按流量统计的度量,无直方图
  4. tshark - uses TCP for pings instead UDP tshark-使用TCP进行ping代替UDP
  5. I have also created a simple C++ socket program where I have Client and Server on each side, and I send UDP packets with counter and timestamp. 我还创建了一个简单的C ++套接字程序,每边都有客户端和服务器,并发送带有计数器和时间戳的UDP数据包。 My program seems to work ok, although since I am not a network programmer I am not 100% sure that I handled buffers correctly (specifically in the case of partial packets etc). 我的程序似乎可以正常运行,尽管由于我不是网络程序员,所以我不能100%地确定我正确地处理了缓冲区(特别是在部分数据包等情况下)。 So I would prefer to use some proven software for this task. 因此,我宁愿使用一些经过验证的软件来完成此任务。

Can you recommend something? 你能推荐点什么吗?

Thanks 谢谢

It depends. 这取决于。 If all you want is a trace with timestamps, Wireshark is your friend: https://www.wireshark.org/ 如果您想要的只是带有时间戳的跟踪信息,Wireshark就是您的朋友: https : //www.wireshark.org/

I would like to remind you that UDP is a message based protocol and packets have definite boundaries. 我想提醒您,UDP是基于消息的协议,数据包具有明确的边界。 There cannot be reception of partial packets. 无法接收部分数据包。 That is, you will either get the complete message or you will not get it. 也就是说,您将获得完整的消息,或者您将不会获得完整的消息。 So, you need not worry about partial packets in UDP. 因此,您不必担心UDP中的部分数据包。

The method of calculating packet drop using counter & calculating latency using time delta appears fine for UDP. 对于UDP,使用计数器计算数据包丢失和使用时间增量计算延迟的方法看起来不错。 However the important point to be taken in to consideration is ensuring the synchronization of the system time of client and server. 但是,要考虑的重要点是确保客户端和服务器的系统时间同步。

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

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