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: Easy Reuse across Multiple Multi Handles

From: Damon Earp via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 28 Jul 2020 14:41:38 -0500

Thanks for shooting down my wild guesses!

I finally got time to sit down and try to figure out what is happening.
The issue goes away when I set CURLMOPT_MAXCONNECTS. Before I was just
setting CURLMOPT_MAX_HOST_CONNECTIONS and most of my connections would live
for a few milliseconds, once MAXCONNECTS is set my reuse and connection
duration increases.

I tried my program with a single event loop and with libcurl 7.61.1 and
7.67.0 with and without setting CURLMOPT_MAXCONNECTS. The durations are all
from the server's perspective, the server has a 30 second idle timeout, and
the test was triggering the system to make ~400 GET requests.

v7.61.1 w/o CURLMOPT_MAXCONNECTS
# of Connections Made: 21
Median, Min, and Max Duration (millisecs): 112, 13, 34640
Median, Min, and Max # of Requests Made: 2, 1, 109

v7.67.0 w/o CURLMOPT_MAXCONNECTS
# of Connections: 35
Median, Min, and Max Duration (millisecs): 75, 17, 30914
Median, Min, and Max # of Requests Made: 2, 1, 67

v7.67.0 w CURLMOPT_MAXCONNECTS
# of Connections: 13
Median, Min, and Max Duration (millisecs): 30967, 30932, 36481
Median, Min, and Max # of Requests Made: 15, 1, 88

I've run the task multiple times with 7.67 and saw similar results to the
ones shared above. I only ran the 7.61.1 a couple times so maybe it's a
fluke that it seems better in terms of # of connections made.

My goal is to maximize reuse, these nodes are constantly talking to one
another, and having a handful of connections constantly open is better for
me than constantly creating and destroying tcp connections. For the time
being I'll just set MAXCONNECTS.

Thanks,
Damon

On Sun, Jul 26, 2020 at 7:06 AM Patrick Schlangen via curl-library <
curl-library_at_cool.haxx.se> wrote:

> Am 26.07.2020 um 13:49 schrieb Daniel Stenberg <daniel_at_haxx.se>:
> >
> > On Sun, 26 Jul 2020, Patrick Schlangen wrote:
> >
> >> that makes me wonder what retrieving the connect time, SSL connection
> time, name resolving time etc would return when a connection was reused. Do
> you have any information on that?
> >
> > Those times will figured out and then stored in the easy handle for the
> later retrieval so it doesn't matter where the connection goes or doesn't
> go after the transfer is done...
>
> Sorry, I probably didn't express my question clearly. I was trying to ask
> what times will be returned when starting a new transfer with a new easy
> handle, which would re-use a connection from the multi pool. Since you
> mentioned the times will be stored in the easy handle, I was wondering what
> would be returned for the new easy handle which re-used a connection and
> hence didn't have to do SSL handshaking, DNS lookup etc.
>
> Hope it makes sense.
>
> Thanks,
>
> Patrick
>
>
> -------------------------------------------------------------------
> Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
> Etiquette: https://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-07-28