You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2013/12/06 04:25:02 UTC
git commit: TS-2420: Remove STAT_SYNC, CONF_SYNC,
and REM_SYNC threads and schedule those continuations in ET_TASK
Updated Branches:
refs/heads/master 354fbc267 -> 853722820
TS-2420: Remove STAT_SYNC, CONF_SYNC, and REM_SYNC threads and schedule
those continuations in ET_TASK
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/85372282
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/85372282
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/85372282
Branch: refs/heads/master
Commit: 853722820d0b36a540ae1ee069e73fbbcc488fc4
Parents: 354fbc2
Author: Phil Sorber <so...@apache.org>
Authored: Thu Dec 5 20:23:55 2013 -0700
Committer: Phil Sorber <so...@apache.org>
Committed: Thu Dec 5 20:23:55 2013 -0700
----------------------------------------------------------------------
CHANGES | 3 ++
lib/records/I_RecProcess.h | 2 +-
lib/records/RecProcess.cc | 73 ++++++++++++++++++++++++-----------------
proxy/Main.cc | 2 +-
4 files changed, 48 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/85372282/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index a11ebca..03a04c6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
Changes with Apache Traffic Server 4.2.0
+ *) [TS-2420] Remove STAT_SYNC, CONF_SYNC, and REM_SYNC threads and schedule those
+ continuations in ET_TASK
+
*) [TS-2372] Enable TLS perfect forward security with ECDHE.
*) [TS-2416] Make TLS the session timeout threshold configurable.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/85372282/lib/records/I_RecProcess.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecProcess.h b/lib/records/I_RecProcess.h
index bc780ac..8faffe7 100644
--- a/lib/records/I_RecProcess.h
+++ b/lib/records/I_RecProcess.h
@@ -33,7 +33,7 @@
//-------------------------------------------------------------------------
int RecProcessInit(RecModeT mode_type, Diags * diags = NULL);
int RecProcessInitMessage(RecModeT mode_type);
-int RecProcessStart(size_t stacksize=DEFAULT_STACKSIZE);
+int RecProcessStart(void);
//-------------------------------------------------------------------------
// Setters for manipulating internal sleep intervals
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/85372282/lib/records/RecProcess.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecProcess.cc b/lib/records/RecProcess.cc
index f5606cc..75b5829 100644
--- a/lib/records/RecProcess.cc
+++ b/lib/records/RecProcess.cc
@@ -23,6 +23,8 @@
#include "libts.h"
+#include "I_Tasks.h"
+
#include "P_EventSystem.h"
#include "P_RecCore.h"
#include "P_RecProcess.h"
@@ -39,6 +41,9 @@ static EventNotify g_force_req_notify;
static int g_rec_raw_stat_sync_interval_ms = REC_RAW_STAT_SYNC_INTERVAL_MS;
static int g_rec_config_update_interval_ms = REC_CONFIG_UPDATE_INTERVAL_MS;
static int g_rec_remote_sync_interval_ms = REC_REMOTE_SYNC_INTERVAL_MS;
+static Event *raw_stat_sync_cont_event;
+static Event *config_update_cont_event;
+static Event *sync_cont_event;
//-------------------------------------------------------------------------
// i_am_the_record_owner, only used for librecprocess.a
@@ -85,14 +90,28 @@ void
RecProcess_set_raw_stat_sync_interval_ms(int ms) {
Debug("statsproc", "g_rec_raw_stat_sync_interval_ms -> %d", ms);
g_rec_raw_stat_sync_interval_ms = ms;
+ if (raw_stat_sync_cont_event) {
+ Debug("statsproc", "Rescheduling raw-stat syncer");
+ raw_stat_sync_cont_event->schedule_every(HRTIME_MSECONDS(g_rec_raw_stat_sync_interval_ms));
+ }
}
void
RecProcess_set_config_update_interval_ms(int ms) {
+ Debug("statsproc", "g_rec_config_update_interval_ms -> %d", ms);
g_rec_config_update_interval_ms = ms;
+ if (config_update_cont_event) {
+ Debug("statsproc", "Rescheduling config syncer");
+ config_update_cont_event->schedule_every(HRTIME_MSECONDS(g_rec_config_update_interval_ms));
+ }
}
void
RecProcess_set_remote_sync_interval_ms(int ms) {
+ Debug("statsproc", "g_rec_remote_sync_interval_ms -> %d", ms);
g_rec_remote_sync_interval_ms = ms;
+ if (sync_cont_event) {
+ Debug("statsproc", "Rescheduling remote syncer");
+ sync_cont_event->schedule_every(HRTIME_MSECONDS(g_rec_remote_sync_interval_ms));
+ }
}
//-------------------------------------------------------------------------
@@ -317,12 +336,10 @@ struct raw_stat_sync_cont: public Continuation
int exec_callbacks(int event, Event *e)
{
- while (true) {
- RecExecRawStatSyncCbs();
- Debug("statsproc", "raw_stat_sync_cont() processed");
- usleep(g_rec_raw_stat_sync_interval_ms * 1000);
- }
- return EVENT_DONE;
+ RecExecRawStatSyncCbs();
+ Debug("statsproc", "raw_stat_sync_cont() processed");
+
+ return EVENT_CONT;
}
};
@@ -340,12 +357,10 @@ struct config_update_cont: public Continuation
int exec_callbacks(int event, Event *e)
{
- while (true) {
- RecExecConfigUpdateCbs(REC_PROCESS_UPDATE_REQUIRED);
- Debug("statsproc", "config_update_cont() processed");
- usleep(g_rec_config_update_interval_ms * 1000);
- }
- return EVENT_DONE;
+ RecExecConfigUpdateCbs(REC_PROCESS_UPDATE_REQUIRED);
+ Debug("statsproc", "config_update_cont() processed");
+
+ return EVENT_CONT;
}
};
@@ -374,20 +389,18 @@ struct sync_cont: public Continuation
int sync(int event, Event *e)
{
- while (true) {
- send_push_message();
- RecSyncStatsFile();
- if (RecSyncConfigToTB(m_tb) == REC_ERR_OKAY) {
- int nbytes;
- RecDebug(DL_Note, "Writing '%s'", g_rec_config_fpath);
- RecHandle h_file = RecFileOpenW(g_rec_config_fpath);
- RecFileWrite(h_file, m_tb->bufPtr(), m_tb->spaceUsed(), &nbytes);
- RecFileClose(h_file);
- }
- Debug("statsproc", "sync_cont() processed");
- usleep(g_rec_remote_sync_interval_ms * 1000);
+ send_push_message();
+ RecSyncStatsFile();
+ if (RecSyncConfigToTB(m_tb) == REC_ERR_OKAY) {
+ int nbytes;
+ RecDebug(DL_Note, "Writing '%s'", g_rec_config_fpath);
+ RecHandle h_file = RecFileOpenW(g_rec_config_fpath);
+ RecFileWrite(h_file, m_tb->bufPtr(), m_tb->spaceUsed(), &nbytes);
+ RecFileClose(h_file);
}
- return EVENT_DONE;
+ Debug("statsproc", "sync_cont() processed");
+
+ return EVENT_CONT;
}
};
@@ -468,24 +481,24 @@ RecProcessInitMessage(RecModeT mode_type)
// RecProcessStart
//-------------------------------------------------------------------------
int
-RecProcessStart(size_t stacksize)
+RecProcessStart(void)
{
if (g_started) {
return REC_ERR_OKAY;
}
- Debug("statsproc", "Starting sync processors:");
+ Debug("statsproc", "Starting sync continuations:");
raw_stat_sync_cont *rssc = NEW(new raw_stat_sync_cont(new_ProxyMutex()));
Debug("statsproc", "\traw-stat syncer");
- eventProcessor.spawn_thread(rssc, "[STAT_SYNC]", stacksize);
+ raw_stat_sync_cont_event = eventProcessor.schedule_every(rssc, HRTIME_MSECONDS(g_rec_raw_stat_sync_interval_ms), ET_TASK);
config_update_cont *cuc = NEW(new config_update_cont(new_ProxyMutex()));
Debug("statsproc", "\tconfig syncer");
- eventProcessor.spawn_thread(cuc, "[CONF_SYNC]", stacksize);
+ config_update_cont_event = eventProcessor.schedule_every(cuc, HRTIME_MSECONDS(g_rec_config_update_interval_ms), ET_TASK);
sync_cont *sc = NEW(new sync_cont(new_ProxyMutex()));
Debug("statsproc", "\tremote syncer");
- eventProcessor.spawn_thread(sc, "[REM_SYNC]", stacksize);
+ sync_cont_event = eventProcessor.schedule_every(sc, HRTIME_MSECONDS(g_rec_remote_sync_interval_ms), ET_TASK);
g_started = true;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/85372282/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 318e825..aed6058 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -1532,7 +1532,7 @@ main(int /* argc ATS_UNUSED */, char **argv)
}
} else {
remapProcessor.start(num_remap_threads, stacksize);
- RecProcessStart(stacksize);
+ RecProcessStart();
initCacheControl();
initCongestionControl();
IpAllow::startup();
Re: git commit: TS-2420: Remove STAT_SYNC, CONF_SYNC, and REM_SYNC
threads and schedule those continuations in ET_TASK
Posted by Phil Sorber <so...@apache.org>.
On Thu, Dec 5, 2013 at 9:08 PM, Leif Hedstrom <zw...@apache.org> wrote:
>
> On Dec 5, 2013, at 8:25 PM, sorber@apache.org wrote:
>
> > Updated Branches:
> > refs/heads/master 354fbc267 -> 853722820
> >
> >
> > TS-2420: Remove STAT_SYNC, CONF_SYNC, and REM_SYNC threads and schedule
> > those continuations in ET_TASK
>
>
>
> I think with this, we should make the proxy.config.task_threads be a
> minimum of 1. E.g.
>
>
I concur. Is this a compatible change?
> diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
> index a54e018..ca805db 100644
> --- a/mgmt/RecordsConfig.cc
> +++ b/mgmt/RecordsConfig.cc
> @@ -114,7 +114,7 @@ RecordElement RecordsConfig[] = {
> ,
> {RECT_CONFIG, "proxy.config.accept_threads", RECD_INT, "1",
> RECU_RESTART_TS, RR_NULL, RECC_INT, "[0-1]", RECA_READ_ONLY}
> ,
> - {RECT_CONFIG, "proxy.config.task_threads", RECD_INT, "2",
> RECU_RESTART_TS, RR_NULL, RECC_INT, "[0-99999]", RECA_READ_ONLY}
> + {RECT_CONFIG, "proxy.config.task_threads", RECD_INT, "2",
> RECU_RESTART_TS, RR_NULL, RECC_INT, "[1-99999]", RECA_READ_ONLY}
> ,
> {RECT_CONFIG, "proxy.config.thread.default.stacksize", RECD_INT,
> "1048576", RECU_RESTART_TS, RR_NULL, RECC_INT, "[131072-104857600]",
> RECA_READ_ONLY}
> ,
>
>
>
> Granted, I don’t think we do much (anything?) with the validations right
> now, but we should :).
>
>
Even if this does nothing, it should be trivial to put in a check somewhere
until validations can be fixed completely. Is there a bug open for that?
All I see is TS-1992.
> — Leif
>
>
Re: git commit: TS-2420: Remove STAT_SYNC, CONF_SYNC, and REM_SYNC threads and schedule those continuations in ET_TASK
Posted by Leif Hedstrom <zw...@apache.org>.
On Dec 5, 2013, at 8:25 PM, sorber@apache.org wrote:
> Updated Branches:
> refs/heads/master 354fbc267 -> 853722820
>
>
> TS-2420: Remove STAT_SYNC, CONF_SYNC, and REM_SYNC threads and schedule
> those continuations in ET_TASK
I think with this, we should make the proxy.config.task_threads be a minimum of 1. E.g.
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index a54e018..ca805db 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -114,7 +114,7 @@ RecordElement RecordsConfig[] = {
,
{RECT_CONFIG, "proxy.config.accept_threads", RECD_INT, "1", RECU_RESTART_TS, RR_NULL, RECC_INT, "[0-1]", RECA_READ_ONLY}
,
- {RECT_CONFIG, "proxy.config.task_threads", RECD_INT, "2", RECU_RESTART_TS, RR_NULL, RECC_INT, "[0-99999]", RECA_READ_ONLY}
+ {RECT_CONFIG, "proxy.config.task_threads", RECD_INT, "2", RECU_RESTART_TS, RR_NULL, RECC_INT, "[1-99999]", RECA_READ_ONLY}
,
{RECT_CONFIG, "proxy.config.thread.default.stacksize", RECD_INT, "1048576", RECU_RESTART_TS, RR_NULL, RECC_INT, "[131072-104857600]", RECA_READ_ONLY}
,
Granted, I don’t think we do much (anything?) with the validations right now, but we should :).
— Leif