监控 Windows Server、Java 中的 UDP 数据包丢失
我的 Java 应用程序通过 UDP 接收数据。 它将数据用于在线数据挖掘任务。 这意味着接收每个数据包并不重要,这也是选择 UDP 的首要原因。 此外,数据是通过 LAN 传输的,因此物理网络应该相当可靠。 无论如何,我无法控制协议的选择或包含的数据。
尽管如此,我还是担心应用程序本身的过载和处理时间过长可能会导致数据包丢失。 我想知道这些事情发生的频率以及丢失的数据量。
理想情况下,我正在寻找一种在生产系统中持续监控数据包丢失的方法。 但部分解决方案也将受到欢迎。
我意识到不可能总是知道 UDP 数据包丢失(不控制数据包内容)。 我正在考虑一些类似于操作系统收到但从未到达应用程序的数据包; 或者应用程序内部可能有一些聪明的解决方案,例如快速读取线程,当客户端繁忙时会删除数据。
我们在 Windows Server 2003 或 2008 下部署。
My Java application receives data through UDP. It uses the data for an online data mining task. This means that it is not critical to receive each and every packet, which is what makes the choice of UDP reasonable on the first place. Also, the data is transferred over LAN, so the physical network should be reasonably reliable. Anyway, I have no control over the choice of protocol or the data included.
Still, I am concerned about packet loss that may arise from overload and long processing time of the application itself. I would like to know how often these things happen and how much data is lost.
Ideally I am looking for a way to monitor packet loss continuously in the production system. But a partial solution would also be welcome.
I realize it is impossible to always know about UDP packet losses (without control on the packet contents). I was thinking of something along the lines of packets received by the OS but never arriving to the application; or maybe some clever solution inside the application, like a fast reading thread that drops data when its client is busy.
We are deploying under Windows Server 2003 or 2008.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题在于,如果您依赖 UDP 格式,则无法判断是否丢失了任何数据包。
如果您需要了解此类信息,则需要将其构建为叠加在 UDP 之上的格式(如 TCP 序列号)。 如果您这样做并且格式很简单,那么您可以轻松地在 Microsoft 的 NetMon 或 WireShark 中创建过滤器来记录和跟踪该信息。
另请注意,TCP 序列号实现还有助于检测使用 UDP 时可能发生的乱序数据包。
The problem is that there is no way to tell that you have lost any packets if you are relying on the UDP format.
If you need to know this type of information, you need to build it into the format that you layer ontop of UDP (like the TCP Sequence Number). If you do that and the format is simple then you can easily create filters into Microsoft's NetMon or WireShark to log and track that information.
Also note that the TCP Sequence Number implementation also helps to detect out of order packets take may happen when using UDP.
如果您担心数据包丢失,请使用 TCP。
这就是它被发明的原因之一。
If you are concerned about packet loss, use TCP.
That's one reason why it was invented.