Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance optimization and final cleanup for read-only threads + automatic sessions #25

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/markdown/manual/release-notes/03_major_enhancements.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

### Automatic Session Management

* Patch 9.0.2 introduces the new concept of automatic sessions. Session allows the xxQS_NAMExx system to synchronize internal data stores, so that client commands can be enforced to get the most recent data. Session management is disabled, but can be enabled by setting the `DISABLE_AUTOMATIC_SESSIONS` parameter to *false* in the `qmaster_params` of the cluster configuration.
* Patch 9.0.2 introduces the new concept of automatic sessions. Session allows the xxQS_NAMExx system to synchronize internal data stores, so that client commands can be enforced to get the most recent data. Session management is enabled, but can be disabled by setting the `DISABLE_AUTOMATIC_SESSIONS` parameter to *true* in the `qmaster_params` of the cluster configuration.

The default for the `qmaster_param` `DISABLE_SECONDARY_DS_READER` is now *false*. This means that the reader thread pool is enabled by default and does not need to be enabled manually as in patch 9.0.1.
The default for the `qmaster_param` `DISABLE_SECONDARY_DS_READER` is now also *false*. This means that the reader thread pool is enabled by default and does not need to be enabled manually as in patch 9.0.1.

The reader thread pool in combination with sessions ensure that commands that trigger changes within the cluster (write-requests), such as submitting a job, modifying a queue or changing a complex value, are executed and the outcome of those commands is guaranteed to be visible to the user who initiated the change. Commands that only read data (read-requests), such as `qstat`, `qhost` or `qconf -s...`, that are triggered by the same user, always return the most recent data although all read-requests in the system are executed completely in parallel to the other xxQS_NAMExx core components. This additional synchronization ensures that the data is consistent for the user with each read-request but on the other side might slow down individual read-requests.

Expand Down
6 changes: 6 additions & 0 deletions source/daemons/qmaster/ocs_MirrorDataStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ namespace ocs {

// process the events
sge_mirror_error mirror_ret = sge_mirror_process_event_list(evc, event_list);
#if 0
DPRINTF("processed events\n");
#endif
lFreeList(&event_list);
if (mirror_ret == SGE_EM_OK) {
did_handle_initial_events = true;
Expand All @@ -372,6 +375,9 @@ namespace ocs {
// update the sessions about the last event that we processed so that waiting requests can continue
if (found_last_event) {
update_sessions_and_move_requests(last_unique_id);
#if 0
DPRINTF("updates sessions and moved requests\n");
#endif
}
} else {
DPRINTF("error during event processing\n");
Expand Down
1 change: 1 addition & 0 deletions source/daemons/qmaster/ocs_MirrorReaderDataStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace ocs {

void MirrorReaderDataStore::subscribe_events() {
sge_mirror_subscribe(evc, SGE_TYPE_ALL, nullptr, nullptr, nullptr, nullptr, nullptr);
evc->ec_set_flush(evc, sgeE_ALL_EVENTS, true, 0);
evc->ec_set_edtime(evc, 1);
}

Expand Down
25 changes: 15 additions & 10 deletions source/libs/evc/sge_event_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1721,22 +1721,27 @@ ec2_add_subscriptionElement(sge_evc_class_t *thiz, ev_event event, bool flush, i
DRETURN_VOID;
}

static void ec2_mod_subscription_flush(sge_evc_class_t *thiz, ev_event event, bool flush, int intervall)
{
auto *sge_evc = (sge_evc_t *) thiz->sge_evc_handle;

static void
ec2_mod_subscription_flush(sge_evc_class_t *thiz, ev_event event, bool flush, int intervall) {
DENTER(EVC_LAYER);


auto *sge_evc = static_cast<sge_evc_t *>(thiz->sge_evc_handle);
if (sge_evc->ec == nullptr) {
ERROR(SFNMAX, MSG_EVENT_UNINITIALIZED_EC);
} else if (event < sgeE_ALL_EVENTS || event >= sgeE_EVENTSIZE) {
WARNING(MSG_EVENT_ILLEGALEVENTID_I, event);
} else {
const lList *subscribed = lGetList(sge_evc->ec, EV_subscribed);
if (event != sgeE_ALL_EVENTS){
if (subscribed) {
lListElem *sub_el = lGetElemUlongRW(subscribed, EVS_id, event);
if (sub_el) {
if (const lList *subscribed = lGetList(sge_evc->ec, EV_subscribed)) {
if (event == sgeE_ALL_EVENTS) {
for (int e = sgeE_ALL_EVENTS; e < static_cast<int>(sgeE_EVENTSIZE); e++) {
if (lListElem *sub_el = lGetElemUlongRW(subscribed, EVS_id, e)) {
lSetBool(sub_el, EVS_flush, flush);
lSetUlong(sub_el, EVS_interval, intervall);
lSetBool(sge_evc->ec, EV_changed, true);
}
}
} else {
if (lListElem *sub_el = lGetElemUlongRW(subscribed, EVS_id, event)) {
lSetBool(sub_el, EVS_flush, flush);
lSetUlong(sub_el, EVS_interval, intervall);
lSetBool(sge_evc->ec, EV_changed, true);
Expand Down
3 changes: 0 additions & 3 deletions source/libs/evm/sge_event_master.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1556,9 +1556,6 @@ add_list_event_for_client_after_commit(lListElem *evr, lList *evr_list, u_long64
static const u_long64 admin_user_session = ocs::SessionManager::get_session_id(bootstrap_get_admin_user());
ocs::SessionManager::set_write_unique_id(admin_user_session, unique_id);

// @TODO: EB remove this
ocs::SessionManager::dump_all();

// Add the request to the event master request list
sge_mutex_lock("event_master_request_mutex", __func__, __LINE__, &Event_Master_Control.request_mutex);
if (single_evr) {
Expand Down
2 changes: 1 addition & 1 deletion source/libs/sgeobj/sge_conf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static bool disable_secondary_ds_reader = DEFAULT_DISABLE_SECONDARY_DS_READER;
#define DEFAULT_DISABLE_SECONDARY_DS_EXECD (false)
static bool disable_secondary_ds_execd = DEFAULT_DISABLE_SECONDARY_DS_EXECD;

#define DEFAULT_DISABLE_AUTOMATIC_SESSIONS (true)
#define DEFAULT_DISABLE_AUTOMATIC_SESSIONS (false)
static bool disable_automatic_sessions = DEFAULT_DISABLE_AUTOMATIC_SESSIONS;

static bool prof_listener_thrd = false;
Expand Down
Loading