You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by du...@apache.org on 2018/04/24 21:17:35 UTC

[trafficserver] branch master updated: Added config option proxy.config.thread.max_heartbeat_mseconds

This is an automated email from the ASF dual-hosted git repository.

duke8253 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 8f4e44a  Added config option proxy.config.thread.max_heartbeat_mseconds
8f4e44a is described below

commit 8f4e44a83145e7af24b8cbfd1459f3a9e13ab171
Author: Fei Deng <du...@gmail.com>
AuthorDate: Wed Apr 11 14:53:25 2018 -0500

    Added config option proxy.config.thread.max_heartbeat_mseconds
---
 doc/admin-guide/files/records.config.en.rst | 13 ++++++++++++-
 iocore/eventsystem/I_EThread.h              |  2 ++
 iocore/eventsystem/UnixEThread.cc           |  4 +++-
 mgmt/RecordsConfig.cc                       |  4 +++-
 proxy/Main.cc                               |  2 ++
 5 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst
index 2d62826..b5f30ea 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -432,6 +432,17 @@ Thread Variables
    HTTP/2 graceful shutdown for now. Stopping Traffic Server here means sending
    `traffic_server` a signal either by `bin/trafficserver stop` or `kill`.
 
+.. ts:cv:: CONFIG proxy.config.thread.max_heartbeat_mseconds INT 60
+   :unit: milliseconds
+
+   Set the maximum heartbeat in milliseconds for threads, ranges from 0 to 1000.
+
+   This controls the maximum amount of time the event loop will wait for I/O activity.
+   On a system that is not busy, this option can be set to a higher value to decrease
+   the spin around overhead. If experiencing unexpected delays, setting a lower value
+   should improve the situation. Note that this setting should only be used by expert
+   system tuners, and will not be beneficial with random fiddling.
+
 Network
 =======
 
@@ -3432,7 +3443,7 @@ Client-Related Configuration
    thread will be rescheduled for other work until the crypto engine operation
    completes. A test crypto engine that inserts a 5 second delay on private key
    operations can be found at :ts:git:`contrib/openssl/async_engine.c`.
-   
+
 .. ts:cv:: CONFIG proxy.config.ssl.engine.conf_file STRING NULL
 
    Specify the location of the openssl config file used to load dynamic crypto
diff --git a/iocore/eventsystem/I_EThread.h b/iocore/eventsystem/I_EThread.h
index 510a19d..bbd7896 100644
--- a/iocore/eventsystem/I_EThread.h
+++ b/iocore/eventsystem/I_EThread.h
@@ -473,3 +473,5 @@ operator new(size_t, ink_dummy_for_new *p)
 #define ETHREAD_GET_PTR(thread, offset) ((void *)((char *)(thread) + (offset)))
 
 extern EThread *this_ethread();
+
+extern int thread_max_heartbeat_mseconds;
diff --git a/iocore/eventsystem/UnixEThread.cc b/iocore/eventsystem/UnixEThread.cc
index f2d04de..05cf373 100644
--- a/iocore/eventsystem/UnixEThread.cc
+++ b/iocore/eventsystem/UnixEThread.cc
@@ -48,6 +48,8 @@ int const EThread::SAMPLE_COUNT[N_EVENT_TIMESCALES] = {10, 100, 1000};
 
 bool shutdown_event_system = false;
 
+int thread_max_heartbeat_mseconds = THREAD_MAX_HEARTBEAT_MSECONDS;
+
 EThread::EThread()
 {
   memset(thread_private, 0, PER_THREAD_DATA);
@@ -258,7 +260,7 @@ EThread::execute_regular()
     next_time             = EventQueue.earliest_timeout();
     ink_hrtime sleep_time = next_time - Thread::get_hrtime_updated();
     if (sleep_time > 0) {
-      sleep_time = std::min(sleep_time, HRTIME_MSECONDS(THREAD_MAX_HEARTBEAT_MSECONDS));
+      sleep_time = std::min(sleep_time, HRTIME_MSECONDS(thread_max_heartbeat_mseconds));
       ++(current_metric->_wait);
     } else {
       sleep_time = 0;
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index ae9cb7d..7b1fa78 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -140,6 +140,8 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.stop.shutdown_timeout", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
+  {RECT_CONFIG, "proxy.config.thread.max_heartbeat_mseconds", RECD_INT, "60", RECU_RESTART_TS, RR_NULL, RECC_INT, "[0-1000]", RECA_READ_ONLY}
+  ,
 
   //##############################################################################
   //#
@@ -201,7 +203,7 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.diags.debug.tags", RECD_STRING, "http|dns", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.diags.debug.client_ip", RECD_STRING, nullptr, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} 
+  {RECT_CONFIG, "proxy.config.diags.debug.client_ip", RECD_STRING, nullptr, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.diags.action.enabled", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
   ,
diff --git a/proxy/Main.cc b/proxy/Main.cc
index a72eaca..d8a84d5 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -1789,6 +1789,8 @@ main(int /* argc ATS_UNUSED */, const char **argv)
     net_config_poll_timeout = 10; // Default value for all platform.
   }
 
+  REC_ReadConfigInteger(thread_max_heartbeat_mseconds, "proxy.config.thread.max_heartbeat_mseconds");
+
   ink_event_system_init(makeModuleVersion(1, 0, PRIVATE_MODULE_HEADER));
   ink_net_init(makeModuleVersion(1, 0, PRIVATE_MODULE_HEADER));
   ink_aio_init(makeModuleVersion(1, 0, PRIVATE_MODULE_HEADER));

-- 
To stop receiving notification emails like this one, please contact
duke8253@apache.org.