Read/send buffer size

Technical discussion about the NMDC and <a href="http://dcpp.net/ADC.html">ADC</A> protocol. The NMDC protocol is documented in the <a href="http://dcpp.net/wiki/">Wiki</a>, so feel free to refer to it.

Moderator: Moderators

Locked
andlju
Posts: 27
Joined: 2003-02-28 12:58
Location: Stockholm, Sweden
Contact:

Read/send buffer size

Post by andlju » 2003-05-02 04:42

Hi.. I've been trying to google around for some information about how to set buffer sizes when sending/receiving files etc over TCP. However, I only tend to find really complicated algorithms, but what I really need is a few guidelines.
    I'm guessing the size should be somewhere in the interval 4k-64k or so, or am I way off?
    Should I focus on setting the buffer so that it is optimized for file reading/writing or network sending/receiving?
    Should I try to sync it with the MTU setting in some obscure way?
My testing so far seems to put me at a buffer around 16-32k, but I've only tested this over my own LAN - and I'm guessing those numbers might not be very accurate over the Internet.. :?

sandos
Posts: 186
Joined: 2003-01-05 10:16
Contact:

Re: Read/send buffer size

Post by sandos » 2003-05-02 10:13

andlju wrote:Hi.. I've been trying to google around for some information about how to set buffer sizes when sending/receiving files etc over TCP. However, I only tend to find really complicated algorithms, but what I really need is a few guidelines.
    I'm guessing the size should be somewhere in the interval 4k-64k or so, or am I way off?
    Should I focus on setting the buffer so that it is optimized for file reading/writing or network sending/receiving?
    Should I try to sync it with the MTU setting in some obscure way?
My testing so far seems to put me at a buffer around 16-32k, but I've only tested this over my own LAN - and I'm guessing those numbers might not be very accurate over the Internet.. :?


Higher latency = larger buffers in general. For 400ms-ish satellite connections with high bandwidth, 128k-512k is useful.

Nev
Programmer
Posts: 40
Joined: 2003-01-03 13:29

Post by Nev » 2003-05-08 00:33

My experience is that it all boils down to the LANs in either end of the connection. If you are on a smooth network with lots of bandwidth then changing the packet size will of course reduce overhead. But on a larger, conjested, network; ethernet-frames will be corrupted, invalidating ip-packets, which makes TCP do alot of resending. Huge packet sizes can in this case decrease performance enourmously.

andlju
Posts: 27
Joined: 2003-02-28 12:58
Location: Stockholm, Sweden
Contact:

Post by andlju » 2003-05-08 02:35

Thank you for the answers! :D
So, the best way might be to give the user a choice of some predefined buffer sizes and let him/her find the one that fit the best?
16k
64k
256k
512k
?
What about drive read/write buffers? Should they simply be in sync with the network buffer, or are there other things to consider?

Locked