Hi Stefan, Thanks a lot for your effort to make rate limiting better! I tried your PR on my speed throttling tests, and unfortunately it doesn't work well on different network speeds and speed limits.
Here are the stats from my tests (HTTP1): Speed limit test [LAN (~700 mbps)], iterations=10 Url=http://192.168.1.218/Data/file_1M.bin, max_speed=8000000 bps time=1019 ms, dnld=1048576 B, speed=8230254 bps, spd_diff=230254 bps, pct=2.9 % time=1029 ms, dnld=1048576 B, speed=8144532 bps, spd_diff=144532 bps, pct=1.8 % ... time=1017 ms, dnld=1048576 B, speed=8246162 bps, spd_diff=246162 bps, pct=3.1 % time=1029 ms, dnld=1048576 B, speed=8148398 bps, spd_diff=148398 bps, pct=1.9 % time=1033 ms, dnld=1048576 B, speed=8119992 bps, spd_diff=119992 bps, pct=1.5 % -------------------------------------------------------------------- avg_deviation=2.2 %, max_deviation=3.1 % Url=http://192.168.1.218/Data/file_1M.bin, max_speed=16000000 bps time=63 ms, dnld=1048576 B, speed=132741430 bps, spd_diff=116741430 bps, pct=729.6 % time=63 ms, dnld=1048576 B, speed=132284678 bps, spd_diff=116284678 bps, pct=726.8 % time=20 ms, dnld=1048576 B, speed=408757735 bps, spd_diff=392757735 bps, pct=2454.7 % time=45 ms, dnld=1048576 B, speed=186236793 bps, spd_diff=170236793 bps, pct=1064.0 % time=54 ms, dnld=1048576 B, speed=154633279 bps, spd_diff=138633279 bps, pct=866.5 % time=17 ms, dnld=1048576 B, speed=482284071 bps, spd_diff=466284071 bps, pct=2914.3 % time=18 ms, dnld=1048576 B, speed=461120284 bps, spd_diff=445120284 bps, pct=2782.0 % time=18 ms, dnld=1048576 B, speed=450918004 bps, spd_diff=434918004 bps, pct=2718.2 % time=19 ms, dnld=1048576 B, speed=426558187 bps, spd_diff=410558187 bps, pct=2566.0 % time=16 ms, dnld=1048576 B, speed=497665980 bps, spd_diff=481665980 bps, pct=3010.4 % -------------------------------------------------------------------- avg_deviation=1983.3 %, max_deviation=3010.4 % Speed limit test [50 mbps], iterations=10 Url=http://192.168.1.218/Data/file_1M.bin, max_speed=8000000 bps time=1025 ms, dnld=1048576 B, speed=8179852 bps, spd_diff=179852 bps, pct=2.2 % time=1018 ms, dnld=1048576 B, speed=8236288 bps, spd_diff=236288 bps, pct=3.0 % ... time=1018 ms, dnld=1048576 B, speed=8234946 bps, spd_diff=234946 bps, pct=2.9 % time=1033 ms, dnld=1048576 B, speed=8113928 bps, spd_diff=113928 bps, pct=1.4 % time=1010 ms, dnld=1048576 B, speed=8300803 bps, spd_diff=300803 bps, pct=3.8 % -------------------------------------------------------------------- avg_deviation=2.6 %, max_deviation=3.8 % Url=http://192.168.1.218/Data/file_1M.bin, max_speed=16000000 bps time=191 ms, dnld=1048576 B, speed=43763514 bps, spd_diff=27763514 bps, pct=173.5 % time=174 ms, dnld=1048576 B, speed=48007792 bps, spd_diff=32007792 bps, pct=200.0 % ... time=191 ms, dnld=1048576 B, speed=43896683 bps, spd_diff=27896683 bps, pct=174.4 % time=188 ms, dnld=1048576 B, speed=44474412 bps, spd_diff=28474412 bps, pct=178.0 % -------------------------------------------------------------------- avg_deviation=180.4 %, max_deviation=200.0 % Speed limit test [20 mbps], iterations=10 Url=http://192.168.1.218/Data/file_1M.bin, max_speed=8000000 bps time=1018 ms, dnld=1048576 B, speed=8234509 bps, spd_diff=234509 bps, pct=2.9 % time=1030 ms, dnld=1048576 B, speed=8144106 bps, spd_diff=144106 bps, pct=1.8 % ... time=1019 ms, dnld=1048576 B, speed=8226810 bps, spd_diff=226810 bps, pct=2.8 % time=1021 ms, dnld=1048576 B, speed=8209510 bps, spd_diff=209510 bps, pct=2.6 % time=1029 ms, dnld=1048576 B, speed=8146626 bps, spd_diff=146626 bps, pct=1.8 % -------------------------------------------------------------------- avg_deviation=2.1 %, max_deviation=2.9 % Url=http://192.168.1.218/Data/file_1M.bin, max_speed=16000000 bps time=455 ms, dnld=1048576 B, speed=18427202 bps, spd_diff=2427202 bps, pct=15.2 % time=449 ms, dnld=1048576 B, speed=18665799 bps, spd_diff=2665799 bps, pct=16.7 % ... time=455 ms, dnld=1048576 B, speed=18429862 bps, spd_diff=2429862 bps, pct=15.2 % time=471 ms, dnld=1048576 B, speed=17795616 bps, spd_diff=1795616 bps, pct=11.2 % -------------------------------------------------------------------- avg_deviation=16.3 %, max_deviation=20.6 % By some reason, the rate limiting worked fine for 8 kbps limit, but was totally off for 16 kbps. Thanks, Dmitry Karpov -----Original Message----- From: curl-library <[email protected]> On Behalf Of Stefan Eissing via curl-library Sent: Wednesday, November 19, 2025 4:26 AM To: [email protected] Cc: Stefan Eissing <[email protected]> Subject: [EXTERNAL] ratelimits revisited Some people recently expressed interest in a more precise implementation of --limit-rate and I had a stab at it the other day. Please see: https://github.com/curl/curl/pull/19384 - increased precision on all HTTP protocols - improved stream window handling on HTTP/2 transfers - implementation of rate limiting in HTTP/3 transfers with ngtcp2 The increased precision should not come at extra cpu costs. If you would take that out for a spin in your environment, I'd be happy to get some feedback on this change. Kind Regards, Stefan -- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.html -- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.html
