Why 'more threads' is the wrong instinct
The easiest way to make a download faster in a benchmark is to open every connection you can. The easiest way to make it slower in the real world is the same thing. Servers throttle aggressive clients, home connections saturate, and a hundred parallel requests fighting for the same pipe each get less than four well-behaved ones.
Concurrency is not a dial to turn up; it is a value to track, because the right number changes every few seconds depending on the network, the server, and what else you are doing.
The 2 to 12 ladder
Our engine starts small — at four workers — and only climbs when the data says there is headroom. Workers step up through a fixed ladder (2, 4, 6, 8, 10, 12) based on two signals: measured throughput and the rate of fragment errors. If adding workers keeps adding bytes per second and errors stay low, the engine takes another rung. If throughput flattens or errors tick up, it stops climbing.
Hysteresis: stopping the oscillation
A naive controller that scales up above 1 MB/s and down below 1 MB/s will flip between the two every second — a classic control-systems failure. The fix is hysteresis: different thresholds for going up than for coming down, and a minimum dwell time before any change. The engine would rather be slightly conservative and stable than constantly chasing its own tail.
Reading the signal, not just the speed
Instantaneous speed is noisy. A single slow second does not mean the server is throttling you; a single fast second does not mean you have headroom. The engine keeps both an instant and a rolling average, and makes its decisions on the rolling figure, so a momentary blip never triggers a change in worker count.
Knowing when to back off
The ceiling is not just about speed. Fragment error rates — timeouts, reset connections, 503s — are the clearest sign that you are asking for more than the server wants to give. When errors rise, the ladder goes down regardless of throughput. Being gentle is not just polite; against most throttling schemes it is also faster.