.NET 套接字每秒最大数据包数
我意识到性能与机器有关。但是假设两台核心 i7 PC 之间有千兆位 LAN,其中一台以最快的速度发送 1k 数据包,另一台接收它们,那么粗略地猜测您期望每秒有多少个数据包?
我问这个问题是因为我正在使用原始套接字实现一个协议,并且我每秒可以发送大约 100,000 个 1k 数据包,但我似乎只能接收 20,000 到 40,000pps 之间的数据包。发送速度非常恒定,但每秒接收的数据包数量在这两个值之间变化很大。 当我达到此接收限制时,CPU 利用率约为 20%。显然,为什么发送比接收快得多?
我没有对接收进行任何处理,只是在上次使用相同缓冲区的接收后再次调用接收。我正在使用 BeginSendTo 和 BeginReceiveFrom 以及相应的 EndReceive 等。 也许 20 -40,000 pps 就很好了? 其他人实现了什么样的 pps?您是否在更高的数据包速率下开始丢失任何数据包? 如果您希望从套接字 tx/rx 中“榨干最后一盎司”,那么最好的使用方法和需要注意的事项是什么。
欢迎尝试所有的建议/想法。
I realize that the performance would be related to the machine. But given say two core i7 PCs with a gigabit LAN between them, with one sending out 1k packets as fast as it can and one receiving them, what would be a rough guess of how many packets per second you would expect?
I ask because I am implementing a protocol using raw sockets and I can send out around 100,000 1k packets a second but I only seems to be able to receive somewhere between 20,000 and 40,000pps. The sending is remarkably constant but the receive packets per second varies wildly between the two values.
When I hit this receive limit the CPU util is around 20%. Why is the send , apparently, so much faster than the receive?
I am not doing any processing on the receive but simply calling receive again after the last receive with the same buffer. I am using BeginSendTo and BeginReceiveFrom with corresponding EndReceive etc.
Maybe 20 -40,000 pps is very good?
What sort of pps do other people achieve and do you start missing any packets at higher packet rates?
If you are looking to "wring every last ounce" out of sockets tx/rx what are the best methods to use and things to look out for.
All pointers / ideas to try welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论