Fixing slow FTP download speeds

It had been happening for so long that I just got used to it. FTP downloads on my Arch Linux desktop, over a 1 Gbps fiber internet connection, were being capped at 300 Kbps. It was frustrating. I thought it might be my ISP throttling FTP downloads, but then I tested the same download from a Mac Mini in our house and was able to get 16 Mbps.

I decided it was time to fix this issue.

It turns out that Linux ships with some very conservative network settings. These settings are apprently good for users not on gigabit networks, but they were hindering me.

Instead of writing out all of the research and trial-and-error I did to tune my TCP transfers, I’ll say that you should read these articles so you can get an understanding of the various settings. The settings you’ll want to use may be different from mine. Be aware, these settings can actually slow down computers if they’re not set properly.

After comparing the values from those articles, and doing some testing of different values, I settled on using:

net.core.rmem_default = 16777216
net.core.rmem_max = 16777216
net.core.wmem_default = 16777216
net.core.wmem_max = 16777216
net.core.optmem_max = 65536
net.ipv4.tcp_rmem = 4096 1048576 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216

And now, my desktop is downloading over FTP at full speed!