cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Choosing between CURL multi vs easy interface

From: Yehezkel Horowitz <horowity_at_checkpoint.com>
Date: Mon, 6 Jul 2015 07:47:46 +0000

> Would CURL multi interface allow my application to serve more concurrent requests? Is it better than the easy interface in this scenario?
The main difference between the easy and the multi, it whether the API is blocking (easy) or not (multi).
If you could ‘store’ the current job, and start handling new job in your application – then go for the multi.
Take into account that you will need to manage the timeouts and the socket events for curl_multi, this is the basic condition for using it.
In addition, you’ll need to manage the jobs of your application (events of each jobs might be coming in any time).
> From intermittent errors related to host name resolution, it appears that a DNS lookup is being done frequently for the same third-party HTTP server. Is there a way to cache the DNS lookup?
You should use the share interface with CURL_LOCK_DATA_DNS option. Look in http://curl.haxx.se/libcurl/c/curl_share_setopt.html
If you go for the multi interface, you will not need it, it is done by default.
PS - you might use timeouts functionality of curl to limit the time you are waiting for the server.
HTH
Yehezkel Horowitz

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