When downloading two files, why does the second one not suddenly speed up after the first one finishes? [closed]

I have noticed that when I am downloading several files at a time, and one of them finishes, the bandwidth that it was consuming is not immediately apportioned to the others. For example, if I have two files being downloaded at 100 Kb/s each, and one finishes, the other does not immediately go up to 200 Kb/s. It does speed up but rather slowly, maybe a few Kb/s every few seconds.

Similarly, when I am downloading one file at 200 Kb/s and then start downloading another one, the first one does not immediately slow down to allow the other one an equal amount of bandwidth.

These are tiny downloads compared to the server and network capacity, so it can't be a capacity issue. Why is my computer, or the server, so slow to distribute the bandwidth equally among the downloads?

Note that I am not asking why my download is slow. I am asking why the redistribution of bandwidth among concurrent downloads is slow.


Solution 1:

How do you measure speed of each download ? If you just look at the number the download client displays, then it's probably an average speed calculated over long period of time, i.e. if you've been downloading something for 10 minutes at 100 KB/s and then the speed jumps to 200 KB/s and continues at that rate for another minute, the average over the whole time is still ~109 KB/s. If you want to track speed of connections in real-time, you can use tools like iftop or iptraf-ng on Linux and there are probably similar tools on Windows too.

Solution 2:

You download over TCP, and TCP has a feature to avoid overloading your links. Overloading would cause congestion and packet drops. It takes several seconds for the TCP stacks on both sides to notice that packets are arriving quicker, so they can ramp up gradually to the new maximum speed.

That is the theoretical answer. In practice, @Jakub-Pasoń probably also has a point when he notes that the download speeds shown are probably averages that do not show changes immediately.