cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Andreas Malzahn <andreas.malzahn_at_fastprotect.net>
Date: Fri, 19 Jul 2013 11:45:30 +0200

Sorry, missed your mail on Sunday ..

Yes, version is 7.31.0

Not sure what resolver backend I can choose - I did not change any code in
my application except the curl version. All connections go to 'localhost' so
I assume no dns resolver is used.

The increasing sleep time looks perfect, works fine in the application - all
requests work with without_fds <= 4 so have minimal delay.

I still have no idea why curl_multi_wait() returns then without a socket to
wait for - probably Windows needs some time to provide sockets.

Thanks, Andreas

-----Ursprüngliche Nachricht-----
Von: curl-library [mailto:curl-library-bounces_at_cool.haxx.se] Im Auftrag von
Daniel Stenberg
Gesendet: Sonntag, 14. Juli 2013 17:07
An: libcurl development
Betreff: Re: HTTP requests often take longer (150 milliseconds) in latest
cURL

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
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-07-19