From 379d1cec70445fa15e9e396eef6b25654bed72c5 Mon Sep 17 00:00:00 2001 From: Evan Zelkowitz <19699200+ezelkow1@users.noreply.github.com> Date: Tue, 14 Aug 2018 13:22:05 -0600 Subject: [PATCH 1/6] Added _ms parameters for *attempts_timeout. If these are the default (0) then the original seconds based parameters will be used, otherwise the _ms ones will be used --- configs/records.config.default.in | 3 +++ doc/admin-guide/files/records.config.en.rst | 26 +++++++++++++++++++++ lib/ts/apidefs.h.in | 3 +++ mgmt/RecordsConfig.cc | 6 +++++ proxy/http/HttpConfig.cc | 25 +++++++++++++------- proxy/http/HttpConfig.h | 6 +++++ proxy/http/HttpSM.cc | 13 +++++++---- src/traffic_server/InkAPI.cc | 15 ++++++++++++ 8 files changed, 84 insertions(+), 13 deletions(-) diff --git a/configs/records.config.default.in b/configs/records.config.default.in index ddeed00ad27..96f33067cc6 100644 --- a/configs/records.config.default.in +++ b/configs/records.config.default.in @@ -37,6 +37,7 @@ CONFIG proxy.config.http.insert_response_via_str INT 0 CONFIG proxy.config.http.parent_proxy_routing_enable INT 0 CONFIG proxy.config.http.parent_proxy.retry_time INT 300 CONFIG proxy.config.http.parent_proxy.connect_attempts_timeout INT 30 +CONFIG proxy.config.http.parent_proxy.connect_attempts_timeout INT 0 CONFIG proxy.config.http.forward.proxy_auth_to_parent INT 0 CONFIG proxy.config.http.uncacheable_requests_bypass_parent INT 1 @@ -62,6 +63,8 @@ CONFIG proxy.config.http.connect_attempts_max_retries_dead_server INT 1 CONFIG proxy.config.http.connect_attempts_rr_retries INT 3 CONFIG proxy.config.http.connect_attempts_timeout INT 30 CONFIG proxy.config.http.post_connect_attempts_timeout INT 1800 +CONFIG proxy.config.http.connect_attempts_timeout_ms INT 0 +CONFIG proxy.config.http.post_connect_attempts_timeout_ms INT 0 CONFIG proxy.config.http.down_server.cache_time INT 60 CONFIG proxy.config.http.down_server.abort_threshold INT 10 diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst index d0f4c5a69fe..a1a21f5fe86 100644 --- a/doc/admin-guide/files/records.config.en.rst +++ b/doc/admin-guide/files/records.config.en.rst @@ -1160,6 +1160,14 @@ Parent Proxy Configuration See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts. +.. ts:cv:: CONFIG proxy.config.http.parent_proxy.connect_attempts_timeout_ms INT 0 + :reloadable: + :overridable: + + The timeout value (in milliseconds) for parent cache connection attempts. If set this will override the usage of proxy.config.http.parent_proxy.connect_attempts_timeout. + + See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts. + .. ts:cv:: CONFIG proxy.config.http.parent_proxy.mark_down_hostdb INT 0 :reloadable: :overridable: @@ -1445,6 +1453,15 @@ Origin Server Connect Attempts See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts. +.. ts:cv:: CONFIG proxy.config.http.connect_attempts_timeout_ms INT 0 + :reloadable: + :overridable: + + The timeout value (in milliseconds) for time to first byte for an origin server + connection. If set this will override the usage of proxy.config.http.connect_attempts_timeout. + + See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts. + .. ts:cv:: CONFIG proxy.config.http.post_connect_attempts_timeout INT 1800 :reloadable: :overridable: @@ -1454,6 +1471,15 @@ Origin Server Connect Attempts See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts. +.. ts:cv:: CONFIG proxy.config.http.post_connect_attempts_timeout_ms INT 0 + :reloadable: + :overridable: + + The timeout value (in milliseconds) for an origin server connection when the client request is a ``POST`` or ``PUT`` + request. If set this will override the usage of proxy.config.http.post_connect_attempts_timeout. + + See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts. + .. ts:cv:: CONFIG proxy.config.http.post.check.content_length.enabled INT 1 Enables (``1``) or disables (``0``) checking the Content-Length: Header for a POST request. diff --git a/lib/ts/apidefs.h.in b/lib/ts/apidefs.h.in index 5b0a9532755..fa35e2207c2 100644 --- a/lib/ts/apidefs.h.in +++ b/lib/ts/apidefs.h.in @@ -711,6 +711,8 @@ typedef enum { TS_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES, TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT, TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT, + TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT_MS, + TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT_MS, TS_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME, TS_CONFIG_HTTP_DOWN_SERVER_ABORT_THRESHOLD, TS_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS, @@ -771,6 +773,7 @@ typedef enum { TS_CONFIG_HTTP_PARENT_PROXY_RETRY_TIME, TS_CONFIG_HTTP_PER_PARENT_CONNECT_ATTEMPTS, TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT, + TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT_MS, TS_CONFIG_HTTP_NORMALIZE_AE, TS_CONFIG_HTTP_INSERT_FORWARDED, TS_CONFIG_HTTP_ALLOW_MULTI_RANGE, diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc index b91891127e1..efddd406cd6 100644 --- a/mgmt/RecordsConfig.cc +++ b/mgmt/RecordsConfig.cc @@ -433,6 +433,8 @@ static const RecordElement RecordsConfig[] = {RECT_CONFIG, "proxy.config.http.parent_proxy.per_parent_connect_attempts", RECD_INT, "2", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.http.parent_proxy.connect_attempts_timeout", RECD_INT, "30", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + , + {RECT_CONFIG, "proxy.config.http.parent_proxy.connect_attempts_timeout_ms", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.http.parent_proxy.mark_down_hostdb", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL} , @@ -490,6 +492,10 @@ static const RecordElement RecordsConfig[] = , {RECT_CONFIG, "proxy.config.http.post_connect_attempts_timeout", RECD_INT, "1800", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , + {RECT_CONFIG, "proxy.config.http.connect_attempts_timeout_ms", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + , + {RECT_CONFIG, "proxy.config.http.post_connect_attempts_timeout_ms", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + , {RECT_CONFIG, "proxy.config.http.down_server.cache_time", RECD_INT, "60", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.http.down_server.abort_threshold", RECD_INT, "10", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc index 6e04efcf30a..144f9b91b16 100644 --- a/proxy/http/HttpConfig.cc +++ b/proxy/http/HttpConfig.cc @@ -1067,12 +1067,16 @@ HttpConfig::startup() HttpEstablishStaticConfigLongLong(c.oride.connect_attempts_rr_retries, "proxy.config.http.connect_attempts_rr_retries"); HttpEstablishStaticConfigLongLong(c.oride.connect_attempts_timeout, "proxy.config.http.connect_attempts_timeout"); HttpEstablishStaticConfigLongLong(c.oride.post_connect_attempts_timeout, "proxy.config.http.post_connect_attempts_timeout"); + HttpEstablishStaticConfigLongLong(c.oride.connect_attempts_timeout_ms, "proxy.config.http.connect_attempts_timeout_ms"); + HttpEstablishStaticConfigLongLong(c.oride.post_connect_attempts_timeout_ms, "proxy.config.http.post_connect_attempts_timeout_ms"); HttpEstablishStaticConfigLongLong(c.oride.parent_connect_attempts, "proxy.config.http.parent_proxy.total_connect_attempts"); HttpEstablishStaticConfigLongLong(c.oride.parent_retry_time, "proxy.config.http.parent_proxy.retry_time"); HttpEstablishStaticConfigLongLong(c.oride.parent_fail_threshold, "proxy.config.http.parent_proxy.fail_threshold"); HttpEstablishStaticConfigLongLong(c.oride.per_parent_connect_attempts, "proxy.config.http.parent_proxy.per_parent_connect_attempts"); HttpEstablishStaticConfigLongLong(c.oride.parent_connect_timeout, "proxy.config.http.parent_proxy.connect_attempts_timeout"); + HttpEstablishStaticConfigLongLong(c.oride.parent_connect_timeout_ms, + "proxy.config.http.parent_proxy.connect_attempts_timeout_ms"); HttpEstablishStaticConfigByte(c.oride.parent_failures_update_hostdb, "proxy.config.http.parent_proxy.mark_down_hostdb"); HttpEstablishStaticConfigLongLong(c.oride.sock_recv_buffer_size_out, "proxy.config.net.sock_recv_buffer_size_out"); @@ -1342,15 +1346,18 @@ HttpConfig::reconfigure() "will never redispatch to another server", m_master.oride.connect_attempts_rr_retries, params->oride.connect_attempts_max_retries); } - params->oride.connect_attempts_rr_retries = m_master.oride.connect_attempts_rr_retries; - params->oride.connect_attempts_timeout = m_master.oride.connect_attempts_timeout; - params->oride.post_connect_attempts_timeout = m_master.oride.post_connect_attempts_timeout; - params->oride.parent_connect_attempts = m_master.oride.parent_connect_attempts; - params->oride.parent_retry_time = m_master.oride.parent_retry_time; - params->oride.parent_fail_threshold = m_master.oride.parent_fail_threshold; - params->oride.per_parent_connect_attempts = m_master.oride.per_parent_connect_attempts; - params->oride.parent_connect_timeout = m_master.oride.parent_connect_timeout; - params->oride.parent_failures_update_hostdb = m_master.oride.parent_failures_update_hostdb; + params->oride.connect_attempts_rr_retries = m_master.oride.connect_attempts_rr_retries; + params->oride.connect_attempts_timeout = m_master.oride.connect_attempts_timeout; + params->oride.post_connect_attempts_timeout = m_master.oride.post_connect_attempts_timeout; + params->oride.connect_attempts_timeout_ms = m_master.oride.connect_attempts_timeout_ms; + params->oride.post_connect_attempts_timeout_ms = m_master.oride.post_connect_attempts_timeout_ms; + params->oride.parent_connect_attempts = m_master.oride.parent_connect_attempts; + params->oride.parent_retry_time = m_master.oride.parent_retry_time; + params->oride.parent_fail_threshold = m_master.oride.parent_fail_threshold; + params->oride.per_parent_connect_attempts = m_master.oride.per_parent_connect_attempts; + params->oride.parent_connect_timeout = m_master.oride.parent_connect_timeout; + params->oride.parent_connect_timeout_ms = m_master.oride.parent_connect_timeout_ms; + params->oride.parent_failures_update_hostdb = m_master.oride.parent_failures_update_hostdb; params->oride.sock_recv_buffer_size_out = m_master.oride.sock_recv_buffer_size_out; params->oride.sock_send_buffer_size_out = m_master.oride.sock_send_buffer_size_out; diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h index eb97757a069..7ed3c289483 100644 --- a/proxy/http/HttpConfig.h +++ b/proxy/http/HttpConfig.h @@ -487,11 +487,14 @@ struct OverridableHttpConfigParams { connect_attempts_rr_retries(3), connect_attempts_timeout(30), post_connect_attempts_timeout(1800), + connect_attempts_timeout_ms(0), + post_connect_attempts_timeout_ms(0), parent_connect_attempts(4), parent_retry_time(300), parent_fail_threshold(10), per_parent_connect_attempts(2), parent_connect_timeout(30), + parent_connect_timeout_ms(0), down_server_timeout(300), client_abort_threshold(10), max_cache_open_read_retries(-1), @@ -705,6 +708,8 @@ struct OverridableHttpConfigParams { MgmtInt connect_attempts_rr_retries; MgmtInt connect_attempts_timeout; MgmtInt post_connect_attempts_timeout; + MgmtInt connect_attempts_timeout_ms; + MgmtInt post_connect_attempts_timeout_ms; //////////////////////////////////// // parent proxy connect attempts // @@ -714,6 +719,7 @@ struct OverridableHttpConfigParams { MgmtInt parent_fail_threshold; MgmtInt per_parent_connect_attempts; MgmtInt parent_connect_timeout; + MgmtInt parent_connect_timeout_ms; MgmtInt down_server_timeout; MgmtInt client_abort_threshold; diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index d41a076cbe1..8dbed370203 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -5927,17 +5927,22 @@ HttpSM::attach_server_session(HttpServerSession *s) MgmtInt connect_timeout; if (t_state.method == HTTP_WKSIDX_POST || t_state.method == HTTP_WKSIDX_PUT) { - connect_timeout = t_state.txn_conf->post_connect_attempts_timeout; + connect_timeout = (t_state.txn_conf->post_connect_attempts_timeout_ms) ? + HRTIME_MSECONDS(t_state.txn_conf->post_connect_attempts_timeout_ms) : + HRTIME_SECONDS(t_state.txn_conf->post_connect_attempts_timeout); } else if (t_state.current.server == &t_state.parent_info) { - connect_timeout = t_state.txn_conf->parent_connect_timeout; + connect_timeout = (t_state.txn_conf->parent_connect_timeout_ms) ? HRTIME_MSECONDS(t_state.txn_conf->parent_connect_timeout_ms) : + HRTIME_SECONDS(t_state.txn_conf->parent_connect_timeout); } else { - connect_timeout = t_state.txn_conf->connect_attempts_timeout; + connect_timeout = (t_state.txn_conf->connect_attempts_timeout_ms) ? + HRTIME_MSECONDS(t_state.txn_conf->connect_attempts_timeout_ms) : + HRTIME_SECONDS(t_state.txn_conf->connect_attempts_timeout); } if (t_state.api_txn_connect_timeout_value != -1) { server_session->get_netvc()->set_inactivity_timeout(HRTIME_MSECONDS(t_state.api_txn_connect_timeout_value)); } else { - server_session->get_netvc()->set_inactivity_timeout(HRTIME_SECONDS(connect_timeout)); + server_session->get_netvc()->set_inactivity_timeout(connect_timeout); } if (t_state.api_txn_active_timeout_value != -1) { diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc index 6225adad450..6119e83b0e8 100644 --- a/src/traffic_server/InkAPI.cc +++ b/src/traffic_server/InkAPI.cc @@ -8026,6 +8026,12 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr case TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT: ret = _memberp_to_generic(&overridableHttpConfig->post_connect_attempts_timeout, conv); break; + case TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT_MS: + ret = _memberp_to_generic(&overridableHttpConfig->connect_attempts_timeout_ms, conv); + break; + case TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT_MS: + ret = _memberp_to_generic(&overridableHttpConfig->post_connect_attempts_timeout_ms, conv); + break; case TS_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME: ret = _memberp_to_generic(&overridableHttpConfig->down_server_timeout, conv); break; @@ -8212,6 +8218,9 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr case TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT: ret = _memberp_to_generic(&overridableHttpConfig->parent_connect_timeout, conv); break; + case TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT_MS: + ret = _memberp_to_generic(&overridableHttpConfig->parent_connect_timeout_ms, conv); + break; case TS_CONFIG_HTTP_ALLOW_MULTI_RANGE: ret = _memberp_to_generic(&overridableHttpConfig->allow_multi_range, conv); break; @@ -8712,6 +8721,8 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf, cnf = TS_CONFIG_NET_SOCK_SEND_BUFFER_SIZE_OUT; } else if (!strncmp(name, "proxy.config.http.connect_attempts_timeout", length)) { cnf = TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT; + } else if (!strncmp(name, "proxy.config.http.connect_attempts_timeout_ms", length)) { + cnf = TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT_MS; } else if (!strncmp(name, "proxy.config.websocket.no_activity_timeout", length)) { cnf = TS_CONFIG_WEBSOCKET_NO_ACTIVITY_TIMEOUT; } @@ -8884,6 +8895,8 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf, case 't': if (!strncmp(name, "proxy.config.http.post_connect_attempts_timeout", length)) { cnf = TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT; + } else if (!strncmp(name, "proxy.config.http.post_connect_attempts_timeout_ms", length)) { + cnf = TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT_MS; } break; } @@ -9003,6 +9016,8 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf, cnf = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_ENCODING_MISMATCH; } else if (!strncmp(name, "proxy.config.http.parent_proxy.connect_attempts_timeout", length)) { cnf = TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT; + } else if (!strncmp(name, "proxy.config.http.parent_proxy.connect_attempts_timeout_ms", length)) { + cnf = TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT_MS; } break; From 386f3cc5d08a175962b8de94027e190e41be290d Mon Sep 17 00:00:00 2001 From: Evan Zelkowitz <19699200+ezelkow1@users.noreply.github.com> Date: Tue, 14 Aug 2018 13:22:05 -0600 Subject: [PATCH 2/6] Added _ms parameters for *attempts_timeout. If these are the default (0) then the original seconds based parameters will be used, otherwise the _ms ones will be used --- configs/records.config.default.in | 3 +++ doc/admin-guide/files/records.config.en.rst | 26 +++++++++++++++++++++ lib/ts/apidefs.h.in | 3 +++ mgmt/RecordsConfig.cc | 6 +++++ plugins/lua/ts_lua_http_config.c | 6 +++++ proxy/http/HttpConfig.cc | 25 +++++++++++++------- proxy/http/HttpConfig.h | 6 +++++ proxy/http/HttpSM.cc | 13 +++++++---- src/traffic_server/InkAPI.cc | 15 ++++++++++++ 9 files changed, 90 insertions(+), 13 deletions(-) diff --git a/configs/records.config.default.in b/configs/records.config.default.in index ddeed00ad27..96f33067cc6 100644 --- a/configs/records.config.default.in +++ b/configs/records.config.default.in @@ -37,6 +37,7 @@ CONFIG proxy.config.http.insert_response_via_str INT 0 CONFIG proxy.config.http.parent_proxy_routing_enable INT 0 CONFIG proxy.config.http.parent_proxy.retry_time INT 300 CONFIG proxy.config.http.parent_proxy.connect_attempts_timeout INT 30 +CONFIG proxy.config.http.parent_proxy.connect_attempts_timeout INT 0 CONFIG proxy.config.http.forward.proxy_auth_to_parent INT 0 CONFIG proxy.config.http.uncacheable_requests_bypass_parent INT 1 @@ -62,6 +63,8 @@ CONFIG proxy.config.http.connect_attempts_max_retries_dead_server INT 1 CONFIG proxy.config.http.connect_attempts_rr_retries INT 3 CONFIG proxy.config.http.connect_attempts_timeout INT 30 CONFIG proxy.config.http.post_connect_attempts_timeout INT 1800 +CONFIG proxy.config.http.connect_attempts_timeout_ms INT 0 +CONFIG proxy.config.http.post_connect_attempts_timeout_ms INT 0 CONFIG proxy.config.http.down_server.cache_time INT 60 CONFIG proxy.config.http.down_server.abort_threshold INT 10 diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst index d0f4c5a69fe..a1a21f5fe86 100644 --- a/doc/admin-guide/files/records.config.en.rst +++ b/doc/admin-guide/files/records.config.en.rst @@ -1160,6 +1160,14 @@ Parent Proxy Configuration See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts. +.. ts:cv:: CONFIG proxy.config.http.parent_proxy.connect_attempts_timeout_ms INT 0 + :reloadable: + :overridable: + + The timeout value (in milliseconds) for parent cache connection attempts. If set this will override the usage of proxy.config.http.parent_proxy.connect_attempts_timeout. + + See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts. + .. ts:cv:: CONFIG proxy.config.http.parent_proxy.mark_down_hostdb INT 0 :reloadable: :overridable: @@ -1445,6 +1453,15 @@ Origin Server Connect Attempts See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts. +.. ts:cv:: CONFIG proxy.config.http.connect_attempts_timeout_ms INT 0 + :reloadable: + :overridable: + + The timeout value (in milliseconds) for time to first byte for an origin server + connection. If set this will override the usage of proxy.config.http.connect_attempts_timeout. + + See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts. + .. ts:cv:: CONFIG proxy.config.http.post_connect_attempts_timeout INT 1800 :reloadable: :overridable: @@ -1454,6 +1471,15 @@ Origin Server Connect Attempts See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts. +.. ts:cv:: CONFIG proxy.config.http.post_connect_attempts_timeout_ms INT 0 + :reloadable: + :overridable: + + The timeout value (in milliseconds) for an origin server connection when the client request is a ``POST`` or ``PUT`` + request. If set this will override the usage of proxy.config.http.post_connect_attempts_timeout. + + See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts. + .. ts:cv:: CONFIG proxy.config.http.post.check.content_length.enabled INT 1 Enables (``1``) or disables (``0``) checking the Content-Length: Header for a POST request. diff --git a/lib/ts/apidefs.h.in b/lib/ts/apidefs.h.in index 5b0a9532755..fa35e2207c2 100644 --- a/lib/ts/apidefs.h.in +++ b/lib/ts/apidefs.h.in @@ -711,6 +711,8 @@ typedef enum { TS_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES, TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT, TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT, + TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT_MS, + TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT_MS, TS_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME, TS_CONFIG_HTTP_DOWN_SERVER_ABORT_THRESHOLD, TS_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS, @@ -771,6 +773,7 @@ typedef enum { TS_CONFIG_HTTP_PARENT_PROXY_RETRY_TIME, TS_CONFIG_HTTP_PER_PARENT_CONNECT_ATTEMPTS, TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT, + TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT_MS, TS_CONFIG_HTTP_NORMALIZE_AE, TS_CONFIG_HTTP_INSERT_FORWARDED, TS_CONFIG_HTTP_ALLOW_MULTI_RANGE, diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc index b91891127e1..efddd406cd6 100644 --- a/mgmt/RecordsConfig.cc +++ b/mgmt/RecordsConfig.cc @@ -433,6 +433,8 @@ static const RecordElement RecordsConfig[] = {RECT_CONFIG, "proxy.config.http.parent_proxy.per_parent_connect_attempts", RECD_INT, "2", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.http.parent_proxy.connect_attempts_timeout", RECD_INT, "30", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + , + {RECT_CONFIG, "proxy.config.http.parent_proxy.connect_attempts_timeout_ms", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.http.parent_proxy.mark_down_hostdb", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL} , @@ -490,6 +492,10 @@ static const RecordElement RecordsConfig[] = , {RECT_CONFIG, "proxy.config.http.post_connect_attempts_timeout", RECD_INT, "1800", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , + {RECT_CONFIG, "proxy.config.http.connect_attempts_timeout_ms", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + , + {RECT_CONFIG, "proxy.config.http.post_connect_attempts_timeout_ms", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + , {RECT_CONFIG, "proxy.config.http.down_server.cache_time", RECD_INT, "60", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.http.down_server.abort_threshold", RECD_INT, "10", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} diff --git a/plugins/lua/ts_lua_http_config.c b/plugins/lua/ts_lua_http_config.c index 11f8ccad80b..08661067a90 100644 --- a/plugins/lua/ts_lua_http_config.c +++ b/plugins/lua/ts_lua_http_config.c @@ -71,6 +71,8 @@ typedef enum { TS_LUA_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES = TS_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES, TS_LUA_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT = TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT, TS_LUA_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT = TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT, + TS_LUA_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT_MS = TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT_MS, + TS_LUA_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT_MS = TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT_MS, TS_LUA_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME = TS_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME, TS_LUA_CONFIG_HTTP_DOWN_SERVER_ABORT_THRESHOLD = TS_CONFIG_HTTP_DOWN_SERVER_ABORT_THRESHOLD, TS_LUA_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS = TS_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS, @@ -132,6 +134,7 @@ typedef enum { TS_LUA_CONFIG_HTTP_PARENT_PROXY_RETRY_TIME = TS_CONFIG_HTTP_PARENT_PROXY_RETRY_TIME, TS_LUA_CONFIG_HTTP_PER_PARENT_CONNECT_ATTEMPTS = TS_CONFIG_HTTP_PER_PARENT_CONNECT_ATTEMPTS, TS_LUA_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT = TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT, + TS_LUA_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT_MS = TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT_MS, TS_LUA_CONFIG_HTTP_ALLOW_MULTI_RANGE = TS_CONFIG_HTTP_ALLOW_MULTI_RANGE, TS_LUA_CONFIG_HTTP_REQUEST_BUFFER_ENABLED = TS_CONFIG_HTTP_REQUEST_BUFFER_ENABLED, TS_LUA_CONFIG_HTTP_ALLOW_HALF_OPEN = TS_CONFIG_HTTP_ALLOW_HALF_OPEN, @@ -196,6 +199,8 @@ ts_lua_var_item ts_lua_http_config_vars[] = { TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT), + TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT_MS), + TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT_MS), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_DOWN_SERVER_ABORT_THRESHOLD), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS), @@ -257,6 +262,7 @@ ts_lua_var_item ts_lua_http_config_vars[] = { TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_PARENT_PROXY_RETRY_TIME), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_PER_PARENT_CONNECT_ATTEMPTS), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT), + TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT_MS), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_ALLOW_MULTI_RANGE), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_REQUEST_BUFFER_ENABLED), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_ALLOW_HALF_OPEN), diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc index 6e04efcf30a..144f9b91b16 100644 --- a/proxy/http/HttpConfig.cc +++ b/proxy/http/HttpConfig.cc @@ -1067,12 +1067,16 @@ HttpConfig::startup() HttpEstablishStaticConfigLongLong(c.oride.connect_attempts_rr_retries, "proxy.config.http.connect_attempts_rr_retries"); HttpEstablishStaticConfigLongLong(c.oride.connect_attempts_timeout, "proxy.config.http.connect_attempts_timeout"); HttpEstablishStaticConfigLongLong(c.oride.post_connect_attempts_timeout, "proxy.config.http.post_connect_attempts_timeout"); + HttpEstablishStaticConfigLongLong(c.oride.connect_attempts_timeout_ms, "proxy.config.http.connect_attempts_timeout_ms"); + HttpEstablishStaticConfigLongLong(c.oride.post_connect_attempts_timeout_ms, "proxy.config.http.post_connect_attempts_timeout_ms"); HttpEstablishStaticConfigLongLong(c.oride.parent_connect_attempts, "proxy.config.http.parent_proxy.total_connect_attempts"); HttpEstablishStaticConfigLongLong(c.oride.parent_retry_time, "proxy.config.http.parent_proxy.retry_time"); HttpEstablishStaticConfigLongLong(c.oride.parent_fail_threshold, "proxy.config.http.parent_proxy.fail_threshold"); HttpEstablishStaticConfigLongLong(c.oride.per_parent_connect_attempts, "proxy.config.http.parent_proxy.per_parent_connect_attempts"); HttpEstablishStaticConfigLongLong(c.oride.parent_connect_timeout, "proxy.config.http.parent_proxy.connect_attempts_timeout"); + HttpEstablishStaticConfigLongLong(c.oride.parent_connect_timeout_ms, + "proxy.config.http.parent_proxy.connect_attempts_timeout_ms"); HttpEstablishStaticConfigByte(c.oride.parent_failures_update_hostdb, "proxy.config.http.parent_proxy.mark_down_hostdb"); HttpEstablishStaticConfigLongLong(c.oride.sock_recv_buffer_size_out, "proxy.config.net.sock_recv_buffer_size_out"); @@ -1342,15 +1346,18 @@ HttpConfig::reconfigure() "will never redispatch to another server", m_master.oride.connect_attempts_rr_retries, params->oride.connect_attempts_max_retries); } - params->oride.connect_attempts_rr_retries = m_master.oride.connect_attempts_rr_retries; - params->oride.connect_attempts_timeout = m_master.oride.connect_attempts_timeout; - params->oride.post_connect_attempts_timeout = m_master.oride.post_connect_attempts_timeout; - params->oride.parent_connect_attempts = m_master.oride.parent_connect_attempts; - params->oride.parent_retry_time = m_master.oride.parent_retry_time; - params->oride.parent_fail_threshold = m_master.oride.parent_fail_threshold; - params->oride.per_parent_connect_attempts = m_master.oride.per_parent_connect_attempts; - params->oride.parent_connect_timeout = m_master.oride.parent_connect_timeout; - params->oride.parent_failures_update_hostdb = m_master.oride.parent_failures_update_hostdb; + params->oride.connect_attempts_rr_retries = m_master.oride.connect_attempts_rr_retries; + params->oride.connect_attempts_timeout = m_master.oride.connect_attempts_timeout; + params->oride.post_connect_attempts_timeout = m_master.oride.post_connect_attempts_timeout; + params->oride.connect_attempts_timeout_ms = m_master.oride.connect_attempts_timeout_ms; + params->oride.post_connect_attempts_timeout_ms = m_master.oride.post_connect_attempts_timeout_ms; + params->oride.parent_connect_attempts = m_master.oride.parent_connect_attempts; + params->oride.parent_retry_time = m_master.oride.parent_retry_time; + params->oride.parent_fail_threshold = m_master.oride.parent_fail_threshold; + params->oride.per_parent_connect_attempts = m_master.oride.per_parent_connect_attempts; + params->oride.parent_connect_timeout = m_master.oride.parent_connect_timeout; + params->oride.parent_connect_timeout_ms = m_master.oride.parent_connect_timeout_ms; + params->oride.parent_failures_update_hostdb = m_master.oride.parent_failures_update_hostdb; params->oride.sock_recv_buffer_size_out = m_master.oride.sock_recv_buffer_size_out; params->oride.sock_send_buffer_size_out = m_master.oride.sock_send_buffer_size_out; diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h index eb97757a069..7ed3c289483 100644 --- a/proxy/http/HttpConfig.h +++ b/proxy/http/HttpConfig.h @@ -487,11 +487,14 @@ struct OverridableHttpConfigParams { connect_attempts_rr_retries(3), connect_attempts_timeout(30), post_connect_attempts_timeout(1800), + connect_attempts_timeout_ms(0), + post_connect_attempts_timeout_ms(0), parent_connect_attempts(4), parent_retry_time(300), parent_fail_threshold(10), per_parent_connect_attempts(2), parent_connect_timeout(30), + parent_connect_timeout_ms(0), down_server_timeout(300), client_abort_threshold(10), max_cache_open_read_retries(-1), @@ -705,6 +708,8 @@ struct OverridableHttpConfigParams { MgmtInt connect_attempts_rr_retries; MgmtInt connect_attempts_timeout; MgmtInt post_connect_attempts_timeout; + MgmtInt connect_attempts_timeout_ms; + MgmtInt post_connect_attempts_timeout_ms; //////////////////////////////////// // parent proxy connect attempts // @@ -714,6 +719,7 @@ struct OverridableHttpConfigParams { MgmtInt parent_fail_threshold; MgmtInt per_parent_connect_attempts; MgmtInt parent_connect_timeout; + MgmtInt parent_connect_timeout_ms; MgmtInt down_server_timeout; MgmtInt client_abort_threshold; diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index d41a076cbe1..8dbed370203 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -5927,17 +5927,22 @@ HttpSM::attach_server_session(HttpServerSession *s) MgmtInt connect_timeout; if (t_state.method == HTTP_WKSIDX_POST || t_state.method == HTTP_WKSIDX_PUT) { - connect_timeout = t_state.txn_conf->post_connect_attempts_timeout; + connect_timeout = (t_state.txn_conf->post_connect_attempts_timeout_ms) ? + HRTIME_MSECONDS(t_state.txn_conf->post_connect_attempts_timeout_ms) : + HRTIME_SECONDS(t_state.txn_conf->post_connect_attempts_timeout); } else if (t_state.current.server == &t_state.parent_info) { - connect_timeout = t_state.txn_conf->parent_connect_timeout; + connect_timeout = (t_state.txn_conf->parent_connect_timeout_ms) ? HRTIME_MSECONDS(t_state.txn_conf->parent_connect_timeout_ms) : + HRTIME_SECONDS(t_state.txn_conf->parent_connect_timeout); } else { - connect_timeout = t_state.txn_conf->connect_attempts_timeout; + connect_timeout = (t_state.txn_conf->connect_attempts_timeout_ms) ? + HRTIME_MSECONDS(t_state.txn_conf->connect_attempts_timeout_ms) : + HRTIME_SECONDS(t_state.txn_conf->connect_attempts_timeout); } if (t_state.api_txn_connect_timeout_value != -1) { server_session->get_netvc()->set_inactivity_timeout(HRTIME_MSECONDS(t_state.api_txn_connect_timeout_value)); } else { - server_session->get_netvc()->set_inactivity_timeout(HRTIME_SECONDS(connect_timeout)); + server_session->get_netvc()->set_inactivity_timeout(connect_timeout); } if (t_state.api_txn_active_timeout_value != -1) { diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc index 6225adad450..6119e83b0e8 100644 --- a/src/traffic_server/InkAPI.cc +++ b/src/traffic_server/InkAPI.cc @@ -8026,6 +8026,12 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr case TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT: ret = _memberp_to_generic(&overridableHttpConfig->post_connect_attempts_timeout, conv); break; + case TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT_MS: + ret = _memberp_to_generic(&overridableHttpConfig->connect_attempts_timeout_ms, conv); + break; + case TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT_MS: + ret = _memberp_to_generic(&overridableHttpConfig->post_connect_attempts_timeout_ms, conv); + break; case TS_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME: ret = _memberp_to_generic(&overridableHttpConfig->down_server_timeout, conv); break; @@ -8212,6 +8218,9 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr case TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT: ret = _memberp_to_generic(&overridableHttpConfig->parent_connect_timeout, conv); break; + case TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT_MS: + ret = _memberp_to_generic(&overridableHttpConfig->parent_connect_timeout_ms, conv); + break; case TS_CONFIG_HTTP_ALLOW_MULTI_RANGE: ret = _memberp_to_generic(&overridableHttpConfig->allow_multi_range, conv); break; @@ -8712,6 +8721,8 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf, cnf = TS_CONFIG_NET_SOCK_SEND_BUFFER_SIZE_OUT; } else if (!strncmp(name, "proxy.config.http.connect_attempts_timeout", length)) { cnf = TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT; + } else if (!strncmp(name, "proxy.config.http.connect_attempts_timeout_ms", length)) { + cnf = TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT_MS; } else if (!strncmp(name, "proxy.config.websocket.no_activity_timeout", length)) { cnf = TS_CONFIG_WEBSOCKET_NO_ACTIVITY_TIMEOUT; } @@ -8884,6 +8895,8 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf, case 't': if (!strncmp(name, "proxy.config.http.post_connect_attempts_timeout", length)) { cnf = TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT; + } else if (!strncmp(name, "proxy.config.http.post_connect_attempts_timeout_ms", length)) { + cnf = TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT_MS; } break; } @@ -9003,6 +9016,8 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf, cnf = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_ENCODING_MISMATCH; } else if (!strncmp(name, "proxy.config.http.parent_proxy.connect_attempts_timeout", length)) { cnf = TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT; + } else if (!strncmp(name, "proxy.config.http.parent_proxy.connect_attempts_timeout_ms", length)) { + cnf = TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT_MS; } break; From 780d3314d0c0ae8c60e858830e4ff565c9b7fb4d Mon Sep 17 00:00:00 2001 From: Evan Zelkowitz Date: Fri, 17 Aug 2018 22:08:59 -0600 Subject: [PATCH 3/6] Add ms timeouts to InkAPI tests --- src/traffic_server/InkAPITest.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/traffic_server/InkAPITest.cc b/src/traffic_server/InkAPITest.cc index fb47d8728e9..5d31f2dc030 100644 --- a/src/traffic_server/InkAPITest.cc +++ b/src/traffic_server/InkAPITest.cc @@ -8622,6 +8622,8 @@ std::array SDK_Overridable_Configs = { "proxy.config.http.connect_attempts_rr_retries", "proxy.config.http.connect_attempts_timeout", "proxy.config.http.post_connect_attempts_timeout", + "proxy.config.http.connect_attempts_timeout_ms", + "proxy.config.http.post_connect_attempts_timeout_ms", "proxy.config.http.down_server.cache_time", "proxy.config.http.down_server.abort_threshold", "proxy.config.http.doc_in_cache_skip_dns", @@ -8682,6 +8684,7 @@ std::array SDK_Overridable_Configs = { "proxy.config.http.parent_proxy.retry_time", "proxy.config.http.parent_proxy.per_parent_connect_attempts", "proxy.config.http.parent_proxy.connect_attempts_timeout", + "proxy.config.http.parent_proxy.connect_attempts_timeout_ms", "proxy.config.http.normalize_ae", "proxy.config.http.insert_forwarded", "proxy.config.http.allow_multi_range", From 348aa2f7aefecf9c2457fe7acce4da16d0e50369 Mon Sep 17 00:00:00 2001 From: Evan Zelkowitz Date: Fri, 17 Aug 2018 22:52:37 -0600 Subject: [PATCH 4/6] Checking in to have this doc fixed as well. Still need to figure out ink test failures --- .../api/functions/TSHttpOverridableConfig.en.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst b/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst index 125e1111706..f74e7c7dfdd 100644 --- a/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst +++ b/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst @@ -105,6 +105,7 @@ TSOverridableConfigKey Value Configuratio :c:macro:`TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES_DEAD_SERVER` :ts:cv:`proxy.config.http.connect_attempts_max_retries_dead_server` :c:macro:`TS_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES` :ts:cv:`proxy.config.http.connect_attempts_rr_retries` :c:macro:`TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT` :ts:cv:`proxy.config.http.connect_attempts_timeout` +:c:macro:`TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT_MS` :ts:cv:`proxy.config.http.connect_attempts_timeout_ms` :c:macro:`TS_CONFIG_HTTP_DEFAULT_BUFFER_SIZE` :ts:cv:`proxy.config.http.default_buffer_size` :c:macro:`TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK` :ts:cv:`proxy.config.http.default_buffer_water_mark` :c:macro:`TS_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS` :ts:cv:`proxy.config.http.doc_in_cache_skip_dns` @@ -135,6 +136,7 @@ TSOverridableConfigKey Value Configuratio :c:macro:`TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB` :ts:cv:`proxy.config.http.parent_proxy.mark_down_hostdb` :c:macro:`TS_CONFIG_HTTP_POST_CHECK_CONTENT_LENGTH_ENABLED` :ts:cv:`proxy.config.http.post.check.content_length.enabled` :c:macro:`TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT` :ts:cv:`proxy.config.http.post_connect_attempts_timeout` +:c:macro:`TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT_MS` :ts:cv:`proxy.config.http.post_connect_attempts_timeout_ms` :c:macro:`TS_CONFIG_HTTP_REDIRECT_USE_ORIG_CACHE_KEY` :ts:cv:`proxy.config.http.redirect_use_orig_cache_key` :c:macro:`TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE` :ts:cv:`proxy.config.http.request_header_max_size` :c:macro:`TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE` :ts:cv:`proxy.config.http.response_header_max_size` @@ -165,7 +167,7 @@ TSOverridableConfigKey Value Configuratio :c:macro:`TS_CONFIG_HTTP_PARENT_PROXY_FAIL_THRESHOLD` :ts:cv:`proxy.config.http.parent_proxy.fail_threshold` :c:macro:`TS_CONFIG_HTTP_PARENT_PROXY_RETRY_TIME` :ts:cv:`proxy.config.http.parent_proxy.retry_time` :c:macro:`TS_CONFIG_HTTP_PER_PARENT_CONNECT_ATTEMPTS` :ts:cv:`proxy.config.http.parent_proxy.per_parent_connect_attempts` -:c:macro:`TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT` :ts:cv:`proxy.config.http.parent_proxy.connect_attempts_timeout` +:c:macro:`TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT_MS` :ts:cv:`proxy.config.http.parent_proxy.connect_attempts_timeout_ms` :c:macro:`TS_CONFIG_HTTP_NORMALIZE_AE` :ts:cv:`proxy.config.http.normalize_ae` :c:macro:`TS_CONFIG_HTTP_ALLOW_MULTI_RANGE` :ts:cv:`proxy.config.http.allow_multi_range` :c:macro:`TS_CONFIG_HTTP_ALLOW_HALF_OPEN` :ts:cv:`proxy.config.http.allow_half_open` From 72a7e86e72bd981ccbc04fe5135e12325a1935c0 Mon Sep 17 00:00:00 2001 From: Evan Zelkowitz <19699200+ezelkow1@users.noreply.github.com> Date: Tue, 21 Aug 2018 12:51:39 -0600 Subject: [PATCH 5/6] Changed to use getrecsource --- proxy/http/HttpSM.cc | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 8dbed370203..4ed66f97cb7 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -5925,18 +5925,35 @@ HttpSM::attach_server_session(HttpServerSession *s) // we fail this server if it doesn't start sending the response // header MgmtInt connect_timeout; + RecSourceT source; if (t_state.method == HTTP_WKSIDX_POST || t_state.method == HTTP_WKSIDX_PUT) { - connect_timeout = (t_state.txn_conf->post_connect_attempts_timeout_ms) ? - HRTIME_MSECONDS(t_state.txn_conf->post_connect_attempts_timeout_ms) : - HRTIME_SECONDS(t_state.txn_conf->post_connect_attempts_timeout); + RecGetRecordSource("proxy.config.http.post_connect_attempts_timeout_ms", &source, true); + + // timeout ms value set by plugin or config, use it + if ((source == REC_SOURCE_PLUGIN) || (source == REC_SOURCE_EXPLICIT)) { + connect_timeout = HRTIME_MSECONDS(t_state.txn_conf->post_connect_attempts_timeout_ms); + } else { + connect_timeout = HRTIME_SECONDS(t_state.txn_conf->post_connect_attempts_timeout); + } } else if (t_state.current.server == &t_state.parent_info) { - connect_timeout = (t_state.txn_conf->parent_connect_timeout_ms) ? HRTIME_MSECONDS(t_state.txn_conf->parent_connect_timeout_ms) : - HRTIME_SECONDS(t_state.txn_conf->parent_connect_timeout); + RecGetRecordSource("proxy.config.http.parent_proxy.connect_attempts_timeout_ms", &source, true); + + // timeout ms value set by plugin or config, use it + if ((source == REC_SOURCE_PLUGIN) || (source == REC_SOURCE_EXPLICIT)) { + connect_timeout = HRTIME_MSECONDS(t_state.txn_conf->parent_connect_timeout_ms); + } else { + connect_timeout = HRTIME_SECONDS(t_state.txn_conf->parent_connect_timeout); + } } else { - connect_timeout = (t_state.txn_conf->connect_attempts_timeout_ms) ? - HRTIME_MSECONDS(t_state.txn_conf->connect_attempts_timeout_ms) : - HRTIME_SECONDS(t_state.txn_conf->connect_attempts_timeout); + RecGetRecordSource("proxy.config.http.connect_attempts_timeout_ms", &source, true); + + // timeout ms value set by plugin or config, use it + if ((source == REC_SOURCE_PLUGIN) || (source == REC_SOURCE_EXPLICIT)) { + connect_timeout = HRTIME_MSECONDS(t_state.txn_conf->connect_attempts_timeout_ms); + } else { + connect_timeout = HRTIME_SECONDS(t_state.txn_conf->connect_attempts_timeout); + } } if (t_state.api_txn_connect_timeout_value != -1) { From 919c29d924b1c80a356964f8199ef7dfbbe7a101 Mon Sep 17 00:00:00 2001 From: "Alan M. Carroll" Date: Wed, 22 Aug 2018 08:06:53 -0500 Subject: [PATCH 6/6] Sketch of handling backwards compatibility. --- proxy/http/HttpConfig.cc | 48 +++++++++++++++++++++++++++++++++--- proxy/http/HttpConfig.h | 2 -- proxy/http/HttpSM.cc | 9 +------ src/traffic_server/InkAPI.cc | 1 - 4 files changed, 46 insertions(+), 14 deletions(-) diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc index 144f9b91b16..c54c4f5c88e 100644 --- a/proxy/http/HttpConfig.cc +++ b/proxy/http/HttpConfig.cc @@ -55,6 +55,13 @@ RecRawStatBlock *http_rsb; RecSetRawStatCount(http_rsb, x, 0); \ } while (0); +static bool +http_config_var_is_default(char const *name) +{ + RecSourceT vs; + return REC_ERR_OKAY != RecGetRecordSource(name, &vs) || vs == REC_SOURCE_DEFAULT || vs == REC_SOURCE_NULL; +} + class HttpConfigCont : public Continuation { public: @@ -206,6 +213,28 @@ http_insert_forwarded_cb(const char *name, RecDataT dtype, RecData data, void *c return REC_ERR_OKAY; } +static int +http_connect_attempt_timeout_cb(const char * name, RecDataT dtype, RecData data, void * cookie) { + bool update_p = false; + auto *c = static_cast(cookie); + + if (0 == strcasecmp(name, "proxy.config.http.parent_proxy.connect_attempts_timeout")) { + if (RECD_INT == dtype) { + c->oride.post_connect_attempts_timeout = HRTIME_SECONDS(data.rec_int); + update_p = true; + } + } else if (0 == strcasecmp(name, "proxy.config.http.parent_proxy.connect_attempts_timeout_ms")) { + if (RECD_INT == dtype) { + c->oride.post_connect_attempts_timeout = HRTIME_MSECONDS(data.rec_int); + update_p = true; + } + } + if (update_p) { + http_config_cb(name, dtype, data, cookie); + } + return REC_ERR_OKAY; +} + void register_stat_callbacks() { @@ -958,6 +987,8 @@ load_negative_caching_var(RecRecord const *r, void *cookie) void HttpConfig::startup() { + RecInt n; // temporary for loading special cases. + http_rsb = RecAllocateRawStatBlock((int)http_stat_count); register_stat_callbacks(); @@ -1065,9 +1096,21 @@ HttpConfig::startup() "proxy.config.http.connect_attempts_max_retries_dead_server"); HttpEstablishStaticConfigLongLong(c.oride.connect_attempts_rr_retries, "proxy.config.http.connect_attempts_rr_retries"); - HttpEstablishStaticConfigLongLong(c.oride.connect_attempts_timeout, "proxy.config.http.connect_attempts_timeout"); + + RecRegisterConfigUpdateCb("proxy.config.http.connect_attempts_timeout", &http_connect_attempt_timeout_cb, &c); + RecRegisterConfigUpdateCb("proxy.config.http.connect_attempts_timeout_ms", &http_connect_attempt_timeout_cb, &c); + // Do initial load - use ms if set, otherwise use base if set, otherwise just leave it default. + if (!http_config_var_is_default("proxy.config.connect_attempts_timeout_ms")) { + if (REC_ERR_OKAY == RecGetRecordInt("proxy.config.connect_attempts_timeout_ms", &n)) { + c.oride.connect_attempts_timeout = HRTIME_MSECONDS(n); + } + } else if (!http_config_var_is_default("proxy.config.connect_attempts_timeout")) { + if (REC_ERR_OKAY == RecGetRecordInt("proxy.config.connect_attempts_timeout", &n)) { + c.oride.connect_attempts_timeout = HRTIME_SECONDS(n); + } + } + HttpEstablishStaticConfigLongLong(c.oride.post_connect_attempts_timeout, "proxy.config.http.post_connect_attempts_timeout"); - HttpEstablishStaticConfigLongLong(c.oride.connect_attempts_timeout_ms, "proxy.config.http.connect_attempts_timeout_ms"); HttpEstablishStaticConfigLongLong(c.oride.post_connect_attempts_timeout_ms, "proxy.config.http.post_connect_attempts_timeout_ms"); HttpEstablishStaticConfigLongLong(c.oride.parent_connect_attempts, "proxy.config.http.parent_proxy.total_connect_attempts"); HttpEstablishStaticConfigLongLong(c.oride.parent_retry_time, "proxy.config.http.parent_proxy.retry_time"); @@ -1349,7 +1392,6 @@ HttpConfig::reconfigure() params->oride.connect_attempts_rr_retries = m_master.oride.connect_attempts_rr_retries; params->oride.connect_attempts_timeout = m_master.oride.connect_attempts_timeout; params->oride.post_connect_attempts_timeout = m_master.oride.post_connect_attempts_timeout; - params->oride.connect_attempts_timeout_ms = m_master.oride.connect_attempts_timeout_ms; params->oride.post_connect_attempts_timeout_ms = m_master.oride.post_connect_attempts_timeout_ms; params->oride.parent_connect_attempts = m_master.oride.parent_connect_attempts; params->oride.parent_retry_time = m_master.oride.parent_retry_time; diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h index 7ed3c289483..36acc638cd7 100644 --- a/proxy/http/HttpConfig.h +++ b/proxy/http/HttpConfig.h @@ -487,7 +487,6 @@ struct OverridableHttpConfigParams { connect_attempts_rr_retries(3), connect_attempts_timeout(30), post_connect_attempts_timeout(1800), - connect_attempts_timeout_ms(0), post_connect_attempts_timeout_ms(0), parent_connect_attempts(4), parent_retry_time(300), @@ -708,7 +707,6 @@ struct OverridableHttpConfigParams { MgmtInt connect_attempts_rr_retries; MgmtInt connect_attempts_timeout; MgmtInt post_connect_attempts_timeout; - MgmtInt connect_attempts_timeout_ms; MgmtInt post_connect_attempts_timeout_ms; //////////////////////////////////// diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 4ed66f97cb7..8a8ade30ebc 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -5946,14 +5946,7 @@ HttpSM::attach_server_session(HttpServerSession *s) connect_timeout = HRTIME_SECONDS(t_state.txn_conf->parent_connect_timeout); } } else { - RecGetRecordSource("proxy.config.http.connect_attempts_timeout_ms", &source, true); - - // timeout ms value set by plugin or config, use it - if ((source == REC_SOURCE_PLUGIN) || (source == REC_SOURCE_EXPLICIT)) { - connect_timeout = HRTIME_MSECONDS(t_state.txn_conf->connect_attempts_timeout_ms); - } else { - connect_timeout = HRTIME_SECONDS(t_state.txn_conf->connect_attempts_timeout); - } + connect_timeout = HRTIME_MSECONDS(t_state.txn_conf->connect_attempts_timeout); } if (t_state.api_txn_connect_timeout_value != -1) { diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc index 6119e83b0e8..adf557a68d4 100644 --- a/src/traffic_server/InkAPI.cc +++ b/src/traffic_server/InkAPI.cc @@ -8027,7 +8027,6 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr ret = _memberp_to_generic(&overridableHttpConfig->post_connect_attempts_timeout, conv); break; case TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT_MS: - ret = _memberp_to_generic(&overridableHttpConfig->connect_attempts_timeout_ms, conv); break; case TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT_MS: ret = _memberp_to_generic(&overridableHttpConfig->post_connect_attempts_timeout_ms, conv);