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.

Easy Reuse across Multiple Multi Handles

From: Damon Earp via curl-library <curl-library_at_cool.haxx.se>
Date: Thu, 9 Jul 2020 17:08:02 -0500

Situation:
We have several threads each with their own multi handles working with
libevent. Recently we thought it'd be nice to start reusing easy handles,
as the cost of creating a new one is expensive compared to curl_easy_reset.
However something interesting happened, our connection reuse plummeted.

After curl_multi_socket_action is called we check if any requests are
complete. All easy handles paired with CURLMSG_DONE are returned to a pool
of easies to be reused. Upon being returned to the pool, if the pool is
full we do curl_easy_cleanup, otherwise curl_easy_reset. Any handle that is
reset can be used by any multi handle.

Question:
After curl_multi_info_read says a request is complete, does the easy handle
still hold the connection? Then using the easy in a different multi would
cause the connection to be closed?

Setup:
We are running libcurl 7.67 w/ c-ares 1.15.0 on Debian 9.

As always thanks for the awesome tool and taking the time to answer these
questions.
Damon

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