减少大容量 Intranet 应用程序通信中的网络延迟

发布于 2024-10-26 19:45:42 字数 217 浏览 2 评论 0原文

我们有一组服务器应用程序,用于从设备/工具接收测量数据。消息传输时间是目前我们的主要瓶颈,因此我们有兴趣减少它以改进流程。工具和服务器应用程序之间的通信是通过在 Redhat Linux 上使用 C++ 进行的 TCP/IP 套接字进行的。

是否可以通过更改 TCP/IP 配置设置或调整 tcp 内核功能来减少使用硬件的消息传输时间? (我们可以牺牲安全性来换取速度,因为通信是在安全的内联网上进行的)

We have a set of server applications which receive measurement data from equipment/tools. Message transfer time is currently our main bottleneck, so we are interested in reducing it to improve the process. The communication between the tools and server applications is via TCP/IP sockets made using C++ on Redhat Linux.

Is it possible to reduce the message transfer time using hardware, by changing the TCP/IP configuration settings or by tweaking tcp kernel functions? (we can sacrifice security for speed, since communication is on a secure intranet)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

谁把谁当真 2024-11-02 19:45:42

根据工作负载,在套接字连接上禁用 Nagle 算法 会有很大帮助。

当处理大量小消息时,我发现这会产生巨大的差异。

根据记忆,我相信 C++ 的套接字选项称为 TCP_NODELAY

Depending on the workload, disabling Nagle's Algorithm on the socket connection can help a lot.

When working with high volumes of small messages, i found this made a huge difference.

From memory, I believe the socket option for C++ was called TCP_NODELAY

岁月染过的梦 2024-11-02 19:45:42

正如 @Jerry Coffin 提议的那样,您可以切换到 UDP。 UDP 是不可靠的协议,这意味着您可能会丢失数据包,或者它们可能以错误的顺序到达,或者被重复。因此,您需要在应用程序级别处理这些情况。由于您可能会丢失一些数据(正如您在评论中所述),因此无需重新传输(任何可靠协议中最复杂的部分)。您只需要删除过时的数据包即可。使用简单的序列编号即可完成。

是的,您可以使用 RTP(它具有序列编号),但您不需要它。对于您的简单案例来说,RTP 看起来有点大材小用。它具有许多其他功能,主要用于多媒体流。

[编辑]和类似的问题此处

As @Jerry Coffin proposed, you can switch to UDP. UDP is unreliable protocol, this means you can lose your packets, or they can arrive in wrong order, or be duplicated. So you need to handle these cases on application level. Since you can lose some data (as you stated in your comment) no need for retransmission (the most complicated part of any reliable protocol). You just need to drop outdated packets. Use simple sequence numbering and you're done.

Yes, you can use RTP (it has sequence numbering) but you don't need it. RTP looks like an overkill for your simple case. It has many other features and is used mainly for multimedia streaming.

[EDIT] and similar question here

南风起 2024-11-02 19:45:42

在硬件方面,尝试英特尔服务器网卡并确保TCP 卸载引擎 (ToE) 已启用。

如果您想要更好的延迟,但要以牺牲goodput 考虑减少中断合并周期。有关更多详细信息,请参阅英特尔文档,因为它们提供了大量可配置参数。

On the hardware side try Intel Server NICs and make sure the TCP offload Engine (ToE) is enabled.

There is also an important decision to make between latency and goodput, if you want better latency at expense of goodput consider reducing the interrupt coalescing period. Consult the Intel documentation for further details as they offer quite a number of configurable parameters.

格子衫的從容 2024-11-02 19:45:42

如果可以的话,减少延迟的明显步骤是从 TCP 切换到 UDP。

If you can, the obvious step to reduce latency would be to switch from TCP to UDP.

神回复 2024-11-02 19:45:42

是的。

谷歌“TCP 帧大小”了解详细信息。

Yes.

Google "TCP frame size" for details.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文