Choosing buffer size for FTP and HTTP transfers

Choose a buffer size over 8KB. 9000 is typically the largest MTU (maximum transmission unit) size used in even the fastest networks.

When you use a buffer larger than the MTU of the connection, the operating system will break it down in to MTU sized pieces as needed, and thus anything you use over the MTU will have little effect on network performance.

However, using a large buffer will likely have other effect on performance, if you're transferring files, then using large buffers may increase the read performance, thus improving the speed of your application.

So, Usually picking a nice round number like 16KB is a good idea. Definitely don't go under 1500, as this can negatively effect network performance (causing the operating system to sometimes send small packets, which decrease performance on the network).


First, get some measurements.

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.