TCP/IP 应用程序 Keepalive 大小和带宽开销 [英] TCP/IP application Keepalive size, and bandwidth overhead

查看:68
本文介绍了TCP/IP 应用程序 Keepalive 大小和带宽开销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个 Java 服务器(java.net.Socketjava.net.ServerSocketjava.io.ObjectOutputStreamjava.io.ObjectInputStream) 并且我知道我将为它分配有限的带宽.

I'm writing a Java server (java.net.Socket, java.net.ServerSocket, java.io.ObjectOutputStream, java.io.ObjectInputStream) and I know I'm going to have limited bandwidth allocated for it.

我为我的输出和输入流编写了一个装饰器对象,因此我可以计算有多少字节通过它来进行分析.但这不会让我知道我用于连接的开销量.

I've written a decorator object for my output and input streams so I can count how many bytes go through it for profiling purposes. But this won't give me any indication of the amount of overhead I'm using for the connection.

我预计不会太多,但我想为此做好准备.我不会尝试优化它,我只是想知道出于后勤原因(我必须请求多少带宽等)需要多少.

I don't anticipate it will be much, but I'd like to prepare for it. I'm not going try to optimize it, I just want to know how much it will be for logistical reasons (how much bandwidth must I request, etc.)

我不是第一个尝试获取此信息的人,但我似乎无法找到有关 Java 套接字和 TCP/IP 开销的一般资源.(可能是因为没有什么值得注意的地方......如果我们在每分钟 kb 的数量级上,这真的不是什么大问题,但我还是想知道!)

I can't be the first person to try to get this information, but I can't seem to find good resources on the overhead of Java Sockets and TCP/IP in general. (Perhaps that's because there's nothing noteworthy to find... If we're on the order of kb per minute, it's really not much of a concern, but I'd still like to know!)

谢谢!

推荐答案

用我们现在掌握的信息来回答这个问题是很有挑战性的……例如,你所说的开销"是什么?是只有 TCP ACK 数据包,还是数据负载以外的所有数据包开销(例如以太网、IP 和 tcp 标头)?

This question is challenging to answer with the information we have right now... for instance, what are you calling 'overhead'? Is it only TCP ACK packets, or all packet overhead (for instance ethernet, IP and tcp headers) for anything other than your data payload?

每分钟有多少连接?每个连接的平均数据传输量是多少?如果有很多非常短暂的连接,你的开销需求就会上升(由于 3 次握手和连接关闭需求)……如果客户端没有读取很多数据,但有很多客户端,你也可能有很高的开销一次保持连接打开数天.

How many connections per minute? What is the average data transfer, per connection? If there are many very short-lived connections, your overhead requirements go up (due to 3-way handshake, and connection close requirements)... you could also have high overhead if the clients don't read much data, but many clients keep the connections open for days at a time.

老实说,在实验室中对此进行建模并对每分钟命中率和并发客户端做出一些假设要好 50 倍……这将为您提供一些大致的数字.尝试将提供给应用程序的带宽限制为您的预算允许的最大值...然后开始退缩...您可以使用 wanem 在双端口 linux 机器上.

Honestly, you're 50x better off modeling this in a lab and making some assumptions about hit rate per minute and concurrent clients... that will give you some ballpark numbers. Play around with limiting the bandwidth afforded to the application to the maximum your budget would allow... then start backing off... you can throttle bandwidth by using wanem on a dual-port linux machine.

获得这样的实验室结果远比理论计算要好.

Getting lab results like this is far better than theoretical calculations.

HTH,\mike(整天都在测试网络设备)

HTH, \mike (who spends all day testing network gear)

这篇关于TCP/IP 应用程序 Keepalive 大小和带宽开销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆