【问题标题】:udp sendto lasting too long (unusual times)udp sendto 持续时间过长(不寻常的时间)
【发布时间】:2021-06-07 01:48:09
【问题描述】:

在我的应用程序中,我通过 UDP 套接字以大约 58MB/秒的速率发送数据。大多数情况下它工作正常,但有时 sendto 持续时间过长,时间分组在 0.1、0.2、0.3 秒左右(见下图)。 我的系统是内核为 2.6.32-24-server 的 linux 系统,每次发送的缓冲区长度为 45000 字节。您知道为什么有时会发生这种情况吗?

【问题讨论】:

  • 你用 RT 内核试过了吗?

标签: linux udp


【解决方案1】:

从发送(2): When the message does not fit into the send buffer of the socket, send() normally blocks, unless the socket has been placed in nonblock‐ ing I/O mode. In nonblocking mode it would fail with the error EAGAIN or EWOULDBLOCK in this case. The select(2) call may be used to deter‐ mine when it is possible to send more data.

除此之外,内核可能同时在做其他事情。如果是这种情况,按照 yi_H 的建议,使用 RT 内核可能会有所帮助。

【讨论】:

  • 令我奇怪的是为什么是 0.1、0.2、0.3 等等
  • 对于网络来说,10 秒也是一个可怕的长时间......你如何发送数据?它是均匀发送还是突发发送?发送缓冲区是否已满? 100Mb/1Gb/.. 卡?
  • 很均匀,我们有 1Gb 卡,我们已经升级到 2.6.38-10,厚度更小(之前的 2.6.32-24 没有),现在我们无法复制问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-02-10
  • 2014-12-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多