cURL / Mailing Lists / curl-library / Single Mail

curl-library

Using single multi interface, vs one multi interface per request

From: James Cheng <jcheng_at_tivo.com>
Date: Mon, 9 Mar 2009 09:55:46 -0700

I'm using libcurl in a C++ library. My library is called to do HTTP GET's of specified assets. For simplicity of design, each instance of my C++ object has its own curl_multi_handle, adds the curl_easy_handle to it, performs the GET, and then cleans itself up.

This comment in another thread caught my eye:

>> Or maybe create many multi handles that each service one easy request ... I
>> was previously planning to keep one multi handle around forever.
>
>it is probably better with the single multi handle as then you'll gain from
>connection re-use which the multiple multi handles approach won't.

From the comment above, it sounds like my approach is less efficient than having a single global multi handle, because it doesn't reuse open connections? Are there other things that it is not able to reuse? DNS cache?

-James
Received on 2009-03-09