rgw: add rgw_curl_tcp_keepalive option for http client requests

this can be useful to prevent long-lived connections from being dropped
due to inactivity

Fixes: https://tracker.ceph.com/issues/48402

Signed-off-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
Casey Bodley 2021-10-20 12:52:29 -04:00 committed by Adam C. Emerson
parent 852e60d6f3
commit 113cda8834
2 changed files with 12 additions and 0 deletions

View File

@ -1951,6 +1951,17 @@ options:
services:
- rgw
with_legacy: true
- name: rgw_curl_tcp_keepalive
type: int
level: advanced
long_desc: Enable TCP keepalive on the HTTP client sockets managed by libcurl. This does not apply to connections received by the HTTP frontend, but only to HTTP requests sent by radosgw. Examples include requests to Keystone for authentication, sync requests from multisite, and requests to key management servers for SSE.
enum_values:
- 0
- 1
default: 0
services:
- rgw
with_legacy: true
- name: rgw_copy_obj_progress
type: bool
level: advanced

View File

@ -586,6 +586,7 @@ int RGWHTTPClient::init_request(rgw_http_req_data *_req_data)
curl_easy_setopt(easy_handle, CURLOPT_ERRORBUFFER, (void *)req_data->error_buf);
curl_easy_setopt(easy_handle, CURLOPT_LOW_SPEED_TIME, cct->_conf->rgw_curl_low_speed_time);
curl_easy_setopt(easy_handle, CURLOPT_LOW_SPEED_LIMIT, cct->_conf->rgw_curl_low_speed_limit);
curl_easy_setopt(easy_handle, CURLOPT_TCP_KEEPALIVE, cct->_conf->rgw_curl_tcp_keepalive);
curl_easy_setopt(easy_handle, CURLOPT_READFUNCTION, send_http_data);
curl_easy_setopt(easy_handle, CURLOPT_READDATA, (void *)req_data);
curl_easy_setopt(easy_handle, CURLOPT_BUFFERSIZE, cct->_conf->rgw_curl_buffersize);