-
Notifications
You must be signed in to change notification settings - Fork 43
Description
API Changes:
- "max_connections" option default was changed from 5 to -1. For details see https://curl.haxx.se/libcurl/c/CURLMOPT_MAXCONNECTS.html
- "max_total_connections" option was added. Default is set to 0. For details see https://curl.haxx.se/libcurl/c/CURLMOPT_MAX_TOTAL_CONNECTIONS.html
- "max_total_connections" will be ignored for curl versions less then 7.30
It’s also better to mention how to interpret this options in order to avoid possible problems such as in here.
First of all defaults should be usually enough. It is rare when you might need to tune this options. So, when in doubt go with defaults.
Here are some tips about using these options:
-
You may want to control maximum number of sockets using by a particular http client at the same time. For example, your system is doing lots of requests to distinct hosts (so curl cannot reuse sockets) and this requests take too much time to perform. In this case setting "max_total_connections" may be useful, which tells curl to hold all requests from creating a new socket if that number is reached.
-
If you are going to set these options, you should avoid setting "max_connections" less then "max_total_connections" unless you are confident about your actions. When "max_connections" option is less then "max_total_connections" in some cases curl will not reuse sockets if requests is going to the same hosts. If the limit is reached, curl will first create a new socket, send a request, then wait for the first connection to free and close it in order to maintain max_connections cache size. In worst case scenario it will result in new socket creation on every request, even if all requests are going to the same host. See this issue for details.
Requested by @RunsFor in tarantool/tarantool#3945
It seems @TarantoolBot missed this request.