You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2015/02/23 19:23:29 UTC
trafficserver git commit: TS-3356: make
proxy.config.net.default_inactivity_timeout reloadable
Repository: trafficserver
Updated Branches:
refs/heads/master 8c71ba112 -> d4263b1f7
TS-3356: make proxy.config.net.default_inactivity_timeout reloadable
Make proxy.config.net.default_inactivity_timeout reloadable. Update
the docs and add a metric to count how many times this happens.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/d4263b1f
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/d4263b1f
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/d4263b1f
Branch: refs/heads/master
Commit: d4263b1f7d1dd6468db87842030bf79e1e604fd0
Parents: 8c71ba1
Author: James Peach <jp...@apache.org>
Authored: Sun Feb 1 11:26:33 2015 -0800
Committer: James Peach <jp...@apache.org>
Committed: Mon Feb 23 10:14:47 2015 -0800
----------------------------------------------------------------------
.../configuration/records.config.en.rst | 9 ++++++
iocore/net/Net.cc | 5 +++
iocore/net/P_Net.h | 1 +
iocore/net/UnixNet.cc | 33 +++++++++++++++-----
mgmt/RecordsConfig.cc | 2 +-
5 files changed, 42 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d4263b1f/doc/reference/configuration/records.config.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/configuration/records.config.en.rst b/doc/reference/configuration/records.config.en.rst
index 7c0b4f6..176d60d 100644
--- a/doc/reference/configuration/records.config.en.rst
+++ b/doc/reference/configuration/records.config.en.rst
@@ -285,6 +285,15 @@ Network
handled. This should be tuned according to your memory size, and expected
work load.
+.. ts:cv:: CONFIG proxy.config.net.default_inactivity_timeout INT 86400
+ :reloadable:
+
+ The connection inactivity timeout (in seconds) to apply when
+ Traffic Server detects that no inactivity timeout has been applied
+ by the HTTP state machine. When this timeout is applied, the
+ `proxy.process.net.default_inactivity_timeout_applied` metric
+ is incremented.
+
.. ts:cv:: LOCAL proxy.local.incoming_ip_to_bind STRING 0.0.0.0 [::]
Controls the global default IP addresses to which to bind proxy server ports. The value is a space separated list of IP addresses, one per supported IP address family (currently IPv4 and IPv6).
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d4263b1f/iocore/net/Net.cc
----------------------------------------------------------------------
diff --git a/iocore/net/Net.cc b/iocore/net/Net.cc
index e97070c..9655509 100644
--- a/iocore/net/Net.cc
+++ b/iocore/net/Net.cc
@@ -121,6 +121,11 @@ register_net_stats()
RECD_INT, RECP_NON_PERSISTENT, (int) keep_alive_lru_timeout_count_stat,
RecRawStatSyncSum);
NET_CLEAR_DYN_STAT(keep_alive_lru_timeout_count_stat);
+
+ RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.net.default_inactivity_timeout_applied",
+ RECD_INT, RECP_NON_PERSISTENT, (int) default_inactivity_timeout_stat,
+ RecRawStatSyncSum);
+ NET_CLEAR_DYN_STAT(default_inactivity_timeout_stat);
}
void
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d4263b1f/iocore/net/P_Net.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_Net.h b/iocore/net/P_Net.h
index cb838f3..9ef0d5d 100644
--- a/iocore/net/P_Net.h
+++ b/iocore/net/P_Net.h
@@ -53,6 +53,7 @@ enum Net_Stats
inactivity_cop_lock_acquire_failure_stat,
keep_alive_lru_timeout_total_stat,
keep_alive_lru_timeout_count_stat,
+ default_inactivity_timeout_stat,
Net_Stat_Count
};
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d4263b1f/iocore/net/UnixNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNet.cc b/iocore/net/UnixNet.cc
index 7bc6c19..a654483 100644
--- a/iocore/net/UnixNet.cc
+++ b/iocore/net/UnixNet.cc
@@ -42,14 +42,18 @@ int update_cop_config(const char *name, RecDataT data_type, RecData data, void *
// loops through the list of NetVCs and calls the timeouts
class InactivityCop : public Continuation {
public:
- InactivityCop(ProxyMutex *m):Continuation(m), default_inactivity_timeout(0), total_connections_in(0),
- max_connections_in(0), connections_per_thread_in(0) {
+ InactivityCop(ProxyMutex *m)
+ : Continuation(m), default_inactivity_timeout(0), total_connections_in(0), max_connections_in(0), connections_per_thread_in(0)
+ {
SET_HANDLER(&InactivityCop::check_inactivity);
REC_ReadConfigInteger(default_inactivity_timeout, "proxy.config.net.default_inactivity_timeout");
Debug("inactivity_cop", "default inactivity timeout is set to: %d", default_inactivity_timeout);
REC_ReadConfigInt32(max_connections_in, "proxy.config.net.max_connections_in");
+
RecRegisterConfigUpdateCb("proxy.config.net.max_connections_in", update_cop_config, (void *)this);
+ RecRegisterConfigUpdateCb("proxy.config.net.default_inactivity_timeout", update_cop_config, (void *)this);
}
+
int check_inactivity(int event, Event *e) {
(void) event;
ink_hrtime now = ink_get_hrtime();
@@ -82,6 +86,7 @@ public:
Debug("inactivity_cop", "vc: %p inactivity timeout not set, setting a default of %d", vc,
default_inactivity_timeout);
vc->set_inactivity_timeout(HRTIME_SECONDS(default_inactivity_timeout));
+ NET_INCREMENT_DYN_STAT(default_inactivity_timeout_stat);
} else {
Debug("inactivity_cop_verbose", "vc: %p now: %" PRId64 " timeout at: %" PRId64 " timeout in: %" PRId64, vc,
now, ink_hrtime_to_sec(vc->next_inactivity_timeout_at), ink_hrtime_to_sec(vc->inactivity_timeout_in));
@@ -105,8 +110,11 @@ public:
return 0;
}
+
void set_max_connections(const int32_t x) { max_connections_in = x; }
void set_connections_per_thread(const int32_t x) { connections_per_thread_in = x; }
+ void set_default_timeout(const int x) { default_inactivity_timeout = x; }
+
private:
void keep_alive_lru(NetHandler &nh, ink_hrtime now, Event *e);
int default_inactivity_timeout; // only used when one is not set for some bad reason
@@ -118,12 +126,23 @@ private:
int
update_cop_config(const char *name, RecDataT data_type ATS_UNUSED, RecData data, void *cookie)
{
- if ((cookie != NULL) && (strcmp(name, "proxy.config.net.max_connections_in") == 0)) {
- Debug("inactivity_cop_dynamic", "proxy.config.net.max_connections_in change: %" PRId64, data.rec_int);
- InactivityCop *cop = static_cast<InactivityCop*>(cookie);
- cop->set_max_connections(data.rec_int);
- cop->set_connections_per_thread(0);
+ InactivityCop * cop = static_cast<InactivityCop *>(cookie);
+ ink_assert(cop != NULL);
+
+ if (cop != NULL) {
+ if (strcmp(name, "proxy.config.net.max_connections_in") == 0) {
+ Debug("inactivity_cop_dynamic", "proxy.config.net.max_connections_in updated to %" PRId64, data.rec_int);
+ cop->set_max_connections(data.rec_int);
+ cop->set_connections_per_thread(0);
+ }
+
+ if (strcmp(name, "proxy.config.net.default_inactivity_timeout") == 0) {
+ Debug("inactivity_cop_dynamic", "proxy.config.net.default_inactivity_timeout updated to %" PRId64, data.rec_int);
+ cop->set_default_timeout(data.rec_int);
+ }
+
}
+
return REC_ERR_OKAY;
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d4263b1f/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index b4da3e6..0e6df65 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -810,7 +810,7 @@ static const RecordElement RecordsConfig[] =
,
{RECT_CONFIG, "proxy.config.net.poll_timeout", RECD_INT, "10", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
,
- {RECT_CONFIG, "proxy.config.net.default_inactivity_timeout", RECD_INT, "86400", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+ {RECT_CONFIG, "proxy.config.net.default_inactivity_timeout", RECD_INT, "86400", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
,
//##############################################################################