curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Large download speed deviations for CURLOPT_MAX_RECV_SPEED_LARGE in 8.4.0

From: Daniel Stenberg via curl-library <curl-library_at_lists.haxx.se>
Date: Fri, 1 Dec 2023 09:37:03 +0100 (CET)

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
_at__at_ -298,19 +298,26 _at__at_ 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
Received on 2023-12-01