选择缓冲区大小FTP和HTTP传输 [英] Choosing buffer size for FTP and HTTP transfers

查看:738
本文介绍了选择缓冲区大小FTP和HTTP传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

怎样才能选择一个缓冲区的大小实现低级别的HTTP和FTP传输时的最大吞吐量(从我读或写插座字节)?我的应用程序应该在不同的130 Kbps到3 Mbps的(我知道预期速度事前)连接传输数据与HTTP或FTP。有时,它是一个单向传输,有时是双向的。我应该坚持的一些平均缓冲区大小或根据连接速度?我必须有所不同。

How does one choose the size of a buffer (bytes I read from or write to socket) for the maximum throughput when implementing a low-level HTTP and FTP transfer? My application should transfer data with HTTP or FTP on connections varying from 130 Kbps to 3 Mbps (I know the expected speed beforehand). Sometimes it's a one way transfer, sometimes it goes in both directions. Should I stick with some average buffer size or I must vary it depending on the connection speed?

感谢。

推荐答案

首先,获得一些测量。

然后,在你有一个可靠的性能测试,更改您的缓冲区大小,并绘制出速度曲线图与缓冲区大小。

Then, after you have a reliable performance measurement, make changes to your buffer size and plot a graph of speed vs. buffer size.

由于事先知道的连接速度,你应该能够得到实际速度的一些测量与不同的实际缓冲区大小。

Since you know the connection speeds in advance, you should be able to get some measurements of actual speeds with different actual buffer sizes.

操作系统,协议栈和网络太复杂,从基本原理制定出一个答案。你需要你做任何事情之前测量。

The OS, protocol stack and network is too complex to work out an answer from first principles. You need to measure before you do anything.

这篇关于选择缓冲区大小FTP和HTTP传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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