# Bufferbloat?

Wednesday June 21, 2017
Software Development

Have you ever noticed your internet connection get slower when uploading a large file? I have, but I never put too much thought into it or realized I could do anything about it… Until I stumbled upon this blog post from a systems engineer at Ookla (the company behind speedtest.net). As it turns out, there’s a term for this (bufferbloat), and this is an easily solvable problem.

## What is Bufferbloat

As Brennen explains in his blog, bufferbloat is a problem that occurs when a router’s buffers fill up due to a slow connection (like the slower upload connection most ISPs provide). The rate of data going into the router is faster than the rate of data going out, the buffers get full, and the whole thing slows down. The solution is pretty simple - just send data in a little slower than the fastest rate it can leave.

## Do I Have Bufferbloat?

After stumbling across Brennen’s blog, I wanted to check if my own internet connection was affected by this problem. As it turns out, this is easy to test:

1. ping google.com and leave it running.
2. Run speedtest.net in a browser. Pay particular attention to when the upload test starts.
3. Watch ping, and look for a spike in latency.

If your response times go up during the upload, it’s bufferbloat! In my own results, I saw a roughly 2,650% increase ($$\frac{330 - 12}{12}$$) in ping response time during upload.

## Fixing Bufferbloat

Brennen details how he fixed bufferbloat on his network, but I wanted to solve the problem without shelling out for an expensive router if I could. Luckily, I was already using a Linksys E900 wireless router with DD-WRT installed. DD-WRT supports some basic QoS settings, so I went into the admin panel and set up QoS to limit my WAN uploads to 4,720 kbps, or roughly 80% of what speedtest.net says my max upload speed is.

After applying the QoS settings, I ran the ping test again and my results were unaffected by the upload. Success! I checked the download speeds to, just to confirm my settings changes did not make them significantly worse.

So that’s it. A simple rate limit on my router fixed the problem. My upload rate might be marginally slower due to my own artificial limit, but my download speed will not be impacted. That is, I can continue browsing the internet with normal, fast speeds even while uploading a large file. That’s a trade-off I’m happy to make.

#### Share!

Did you like this blog post? Why not share it with your network!