cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP requests often take longer (150 milliseconds) in latest cURL

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 14 Jul 2013 17:07:27 +0200 (CEST)

On Fri, 12 Jul 2013, Andreas Malzahn wrote:

> When upgrading our application from cURL version 1.25 to 1.31, many HTTP
> requests take now longer - time increased from 40- 60ms to 151ms.

First, I assume you're talking about 7.25.x to 7.31.0. Then, what resolver
backend are you using now and did you use the same one before?

> Is there a special reason for the 50ms wait?

To avoid busy-looping - since there's no external event to trigger the end of
the wait we need to keep checking.

> Maybe this is some bug and 5-10ms wait would be better?

How about starting off with that and then gradually increasing the sleep time
to avoid looping very many times? Somethnig like this:

--- a/lib/easy.c
+++ b/lib/easy.c
@@ -533,9 +533,7 @@ CURLcode curl_easy_perform(CURL *easy)
          if(curlx_tvdiff(after, before) <= 10) {
            without_fds++;
            if(without_fds > 2) {
- int sleep_ms = without_fds * 50;
- if(sleep_ms > 1000)
- sleep_ms = 1000;
+ int sleep_ms = without_fds < 10 ? (1 << (without_fds-1)): 1000;
              Curl_wait_ms(sleep_ms);
            }
          }

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-07-14