On Fri, 1 Dec 2023, Dmitry Karpov via curl-library wrote:

I tried the latest master branch with Daniel's fix, and I still see large deviations (up to 20%) from the speed limit set by CURLOPT_MAX_RECV_SPEED_LARGE. The deviations depend on a network speed and they get bigger when the speed limit gets far from the network speed.

I can't reproduce that. I do this to test:

$ curl --limit-rate 5M localhost/100G -o /dev/null

Here's my debug patch to verify the math in Curl_pgrsLimitWaitTime:

diff --git a/lib/progress.c b/lib/progress.c
index e96cbf7af..8473cfc07 100644
--- a/lib/progress.c
+++ b/lib/progress.c
@@ -298,19 +298,26 @@ timediff_t Curl_pgrsLimitWaitTime(curl_off_t cursize,
       minimum *= 1000;
     else
       minimum = TIMEDIFF_T_MAX;
   }

+  fprintf(stderr, "size % " CURL_FORMAT_CURL_OFF_T
+          " limit: %" CURL_FORMAT_CURL_OFF_T
+          " min: %ld\n",
+          size, limit, minimum);
+
   /*
    * 'actual' is the time in milliseconds it took to actually download the
    * last 'size' bytes.
    */
   actual = Curl_timediff_ceil(now, start);
   if(actual < minimum) {
     /* if it downloaded the data faster than the limit, make it wait the
        difference */
-    return (minimum - actual);
+    timediff_t delta = (minimum - actual);
+    fprintf(stderr, "took %ldms wait %ldms more\n", actual, delta);
+    return delta;
   }

   return 0;
 }


--

 / daniel.haxx.se
 | Commercial curl support up to 24x7 is available!
 | Private help, bug fixes, support, ports, new features
 | https://curl.se/support.html
--
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html

Reply via email to