+1 vote
by (200 points)
edited

In relation to this question, http://forum.rebex.net/questions/173/how-to-optimize-transfer-performance-with-uploadbufferlength, we're still seeing slower ftp upload times than we'd like. The post mentions another option, UseLargeBuffers, which may be available. We'd be interested in this option.

I'm curious what the difference is between UploadBufferLength and the TcpClient.SendBuffer size. Looking at wireshark logs, it appears our send buffer is quite small, even though we've set the upload buffer length to 128k.

Thanks,

Mike

Applies to: Rebex FTP/SSL, Rebex SFTP

1 Answer

+1 vote
by (148k points)
edited

The UploadBufferLength property simply controls how much data Rebex FTP passes to the TCP stack in a single request. Although passing 64KB chunks instead of 4KB chunks can make a big difference, this doesn't affect the underlying transport layers:

The TCP protocol runs over the IP protocol. Most Ethernet LANs use MTU (Maximum Transfer Unit) of 1500 bytes. The size of an IP packet header is 20 bytes and the size of a TCPv4 packet header is 20 bytes as well. This means that 1460 is often the maximum segment size that can be transferred in a single TCP packet over Ethernet II networks. (Protocols like PPPoE can reduce this further.)

On the other hand, the UseLargeBuffers option (currently only available in Rebex SFTP) sets (among other things) Socket.SendBufferSize (equivalent of TcpClient.SendBufferSize) to 256KB and Socket.ReceiveBufferSize to 4MB, which causes larger window size to be used by the TCP protocol for the socket, resulting in increased speed (and slightly increased memory requirements).

We will add this option to the next release Rebex FTP(/SSL) that should be released within a week!

Update: FtpOptions.UseLargeBuffers is available in Rebex FTP(/SSL) v3.0.3793.0.


At the moment, the value of Socket.SendBufferSize is not set explicitly, so it will be whatever the default value is. At my machine, it is 8192 (8KB). You can use the following code to determine the default buffer size at your machine:

using System.Net;
using System.Net.Sockets;

...

int sendBufferSize = new Socket(AddressFamily.InterNetwork,
    SocketType.Stream, ProtocolType.Tcp).SendBufferSize;
by (200 points)
Can you tell me what the default buffer size is now?
by (148k points)
Yes - I added this information to my original answer above.
...