Scheduler-test: ability to propagate solely by NOTIFY

...watching those dumps on the example Graph with excessive dependencies
made blatantly clear that we're dispatching a lot of unnecessary jobs,
since the actual continuation is /always/ triggered by the dependency-NOTIFY.
Before the rework of NOTIFY-Handling, this was rather obscured, but now,
since the NOTIFY trigger itself is also dispatched by the Scheduler,
it ''must be this job'' which actually continues the calculation, since
the main job ''can not pass the gate'' before the dependency notification
arrives.

Thus I've now added a variation to the test setup where all these duplicate
jobs are simply omitted. And, as expected, the computation runs faster
and with less signs of contention. Together with the other additional
parameter (the base expense) we might now actually be able to narrow down
on the observation of a ''expense socket'', which can then be
attributed to something like an ''inherent scheduler overhead''
This commit is contained in:
Fischlurch 2024-01-06 01:44:38 +01:00
parent 001aa829c5
commit f37b67f9bb
3 changed files with 110 additions and 31 deletions

View file

@ -207,6 +207,8 @@ namespace gear {
ScheduleSpec linkToSuccessor (ScheduleSpec&);
ScheduleSpec linkToPredecessor(ScheduleSpec&);
private:
void maybeBuildTerm();
};
@ -544,9 +546,7 @@ namespace gear {
ScheduleSpec::post()
{ // protect allocation
// auto guard = theScheduler_->layer2_.requireGroomingTokenHere();//////////////////////////////////////TODO can we avoid that?
term_ = move(
theScheduler_->activityLang_
.buildCalculationJob (job_, start_,death_));
maybeBuildTerm();
//set up new schedule by retrieving the Activity-chain...
theScheduler_->postChain ({term_->post(), start_
, death_
@ -555,9 +555,24 @@ namespace gear {
return move(*this);
}
/**
* @internal if not done yet, then construct the Activity-Language term
* describing the schedule according to the parameters set thus far.
*/
inline void
ScheduleSpec::maybeBuildTerm()
{
if (term_) return;
term_ = move(
theScheduler_->activityLang_
.buildCalculationJob (job_, start_,death_));
}
inline ScheduleSpec
ScheduleSpec::linkToSuccessor (ScheduleSpec& succSpec)
{
this->maybeBuildTerm();
succSpec.maybeBuildTerm();
term_->appendNotificationTo (*succSpec.term_);
return move(*this);
}
@ -565,6 +580,8 @@ namespace gear {
inline ScheduleSpec
ScheduleSpec::linkToPredecessor (ScheduleSpec& predSpec)
{
predSpec.maybeBuildTerm();
this->maybeBuildTerm();
predSpec.term_->appendNotificationTo (*term_);
return move(*this);
}

View file

@ -1697,9 +1697,13 @@ namespace test {
schedule_[idx] = scheduler_.defineSchedule(calcJob (idx,level))
.manifestation(manID_)
.startTime (jobStartTime(level, idx))
.lifeWindow (deadline_)
.post();
}
.lifeWindow (deadline_);
Node& n = chainLoad_.nodes_[idx];
if (isnil (n.pred)
or schedDepends_)
schedule_[idx].post();
}// Node with dependencies will be triggered by NOTIFY
// and thus must not necessarily be scheduled explicitly.
/** Callback: define a dependency between scheduled jobs */
void

View file

@ -107929,22 +107929,22 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
</html></richcontent>
<icon BUILTIN="smily_bad"/>
</node>
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1704496572319" ID="ID_1195771220" MODIFIED="1704498356010" TEXT="Basis-Aufwand">
<icon BUILTIN="pencil"/>
<node COLOR="#338800" CREATED="1704496572319" ID="ID_1195771220" MODIFIED="1704505413058" TEXT="Basis-Aufwand">
<icon BUILTIN="button_ok"/>
<node COLOR="#338800" CREATED="1704496583222" ID="ID_1103812174" MODIFIED="1704498359764" TEXT="Builder-Parameter vorsehen">
<icon BUILTIN="button_ok"/>
<node COLOR="#435e98" CREATED="1704498304154" ID="ID_1330026678" MODIFIED="1704498336224" TEXT="withBaseExpense &#x27fc; nodeSpeed_">
<icon BUILTIN="info"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1704496590349" ID="ID_55304707" MODIFIED="1704496621212" TEXT="Node-ID mit in die Zeitbestimmung geben">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1704496590349" ID="ID_55304707" MODIFIED="1704505411738" TEXT="Node-ID mit in die Zeitbestimmung geben">
<icon BUILTIN="button_ok"/>
<node CREATED="1704502374254" ID="ID_1148804575" MODIFIED="1704502440579" TEXT="und zwar nur als optionaler 2.Parameter">
<linktarget COLOR="#5c6e82" DESTINATION="ID_1148804575" ENDARROW="Default" ENDINCLINATION="279;-12;" ID="Arrow_ID_1130714740" SOURCE="ID_261862992" STARTARROW="None" STARTINCLINATION="302;13;"/>
</node>
</node>
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1704498344371" ID="ID_33654612" MODIFIED="1704498363401" TEXT="nodeSpeed_ auf alle Schedules aufschlagen">
<icon BUILTIN="flag-pink"/>
<node COLOR="#338800" CREATED="1704498344371" ID="ID_33654612" MODIFIED="1704505409953" TEXT="nodeSpeed_ auf alle Schedules aufschlagen">
<icon BUILTIN="button_ok"/>
<node CREATED="1704502220043" ID="ID_596251248" MODIFIED="1704502237509" TEXT="pa&#xdf;t nicht gut in das insgesamt Level-basierte Planungs-Schema"/>
<node CREATED="1704502239345" ID="ID_1983557540" MODIFIED="1704502271966" TEXT="da es ein Ctx-Parameter ist, kann man es nicht ohne Weiteres in das Zeitger&#xfc;st einarbeiten"/>
<node CREATED="1704502325853" ID="ID_229349758" MODIFIED="1704502347414" TEXT="Node-Info ist bei der Vorberechung dieses Zeitger&#xfc;sts gar nicht (mehr) vorhanden"/>
@ -107952,14 +107952,26 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
<arrowlink COLOR="#5c6e82" DESTINATION="ID_1148804575" ENDARROW="Default" ENDINCLINATION="279;-12;" ID="Arrow_ID_1130714740" STARTARROW="None" STARTINCLINATION="302;13;"/>
</node>
</node>
<node COLOR="#338800" CREATED="1704505416062" ID="ID_118377449" MODIFIED="1704505437747" TEXT="Plausibilit&#xe4;ts-Check durch Beobachten des DUMP ">
<icon BUILTIN="button_ok"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1704496625440" ID="ID_1513875198" MODIFIED="1704496631952" TEXT="Dependency-Planung">
<icon BUILTIN="flag-yellow"/>
<node CREATED="1704496633181" ID="ID_621580292" MODIFIED="1704496661738" TEXT="flexibiliisiert den Zeitpunkt an dem der Job tats&#xe4;chlich abgegeben wird">
<icon BUILTIN="idea"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1704496668636" ID="ID_373319632" MODIFIED="1704496700735" TEXT="er wird verz&#xf6;gert bis zum Setzen der Dependencies">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1704497119360" ID="ID_1584751968" MODIFIED="1704508374621" TEXT="Builder-Parameter vorsehen">
<icon BUILTIN="button_ok"/>
<node COLOR="#435e98" CREATED="1704500223713" ID="ID_1326282155" MODIFIED="1704500283727" TEXT="withScheduleDependency &#x27fc; schedDepends_">
<icon BUILTIN="info"/>
</node>
<node COLOR="#435e98" CREATED="1704500233716" ID="ID_901591846" MODIFIED="1704500283727" TEXT="withScheduleNotify &#x27fc; schedNotify_ 0.0 ... 1.0">
<icon BUILTIN="info"/>
</node>
</node>
<node COLOR="#338800" CREATED="1704496668636" ID="ID_373319632" MODIFIED="1704506709251" TEXT="Pr&#xfc;fen ob eine Node schon Vorl&#xe4;ufer hat...">
<icon BUILTIN="idea"/>
<node COLOR="#5b280f" CREATED="1704496701638" ID="ID_1403516791" MODIFIED="1704496853419" TEXT="Gefahr: verz&#xf6;gerte Planung &#x2014; besteht nicht mehr">
<richcontent TYPE="NOTE"><html>
<head/>
@ -107971,16 +107983,35 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
</html></richcontent>
<icon BUILTIN="button_cancel"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1704496854338" ID="ID_828353402" MODIFIED="1704496907472" TEXT="an der Stelle pr&#xfc;fen, ob die Node schon Vorl&#xe4;ufer hat...">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1704496879110" ID="ID_1613607947" MODIFIED="1704496907473" TEXT="...wenn ja, kann der Nachfolge-Job komplett ausgelassen werden">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1704496879110" ID="ID_1613607947" MODIFIED="1704506704869" TEXT="...wenn ja, mu&#xdf; Nachfolge-Job &#xfc;berhaupt nicht an den Scheduler &#xfc;bergeben werden">
<icon BUILTIN="button_ok"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1704496923552" ID="ID_612925354" MODIFIED="1704496938479" TEXT="Anpassungen im ScheduleSpec (SchedulerAPI) notwendig">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1704496939542" ID="ID_1389691721" MODIFIED="1704497070429" TEXT="Activity-Term nun &#xbb;on-demand&#xab; erzeugen">
<node COLOR="#338800" CREATED="1704508378522" ID="ID_1009406329" MODIFIED="1704508456208" TEXT="Plausibilit&#xe4;ts-Check durch Beobachten des DUMP">
<icon BUILTIN="button_ok"/>
<node COLOR="#435e98" CREATED="1704508394920" ID="ID_603560157" MODIFIED="1704508450457" TEXT="in der Tat: nur noch ein einziger Job wird explizit gescheduled"/>
<node COLOR="#435e98" CREATED="1704508406031" ID="ID_1562900089" MODIFIED="1704508450457" TEXT="Berechnung kommt trotzdem an, und sogar etwas schneller"/>
<node BACKGROUND_COLOR="#e0ceaa" COLOR="#690f14" CREATED="1704508420352" ID="ID_1944262558" MODIFIED="1704508446786" TEXT="an den kritischen Stellen taucht trotzdem die notwenidge Rechenkapazit&#xe4;t auf">
<icon BUILTIN="idea"/>
<node CREATED="1704508460471" ID="ID_1158750541" MODIFIED="1704508465339" TEXT="das ist wirklich verbl&#xfc;ffend"/>
<node CREATED="1704508466387" ID="ID_1330141096" MODIFIED="1704508564637" TEXT="liegt wohl an der fokussierten Kapazit&#xe4;tssteuerung">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<body>
<p>
anders kann ich mir das nicht erkl&#228;ren, denn es ist ja nun immer nur eine kleine Zahl an Eintr&#228;gen in der Queue, d.h. es besteht durchaus die Gefahr, da&#223; sich Worker schlafen legen, weil die Queue scheinbar leer ist. Tats&#228;chlich passiert das aber nur in den Abschnitten mit geringer Parallelit&#228;t (ja der Doppel-Strang wird nun nur von einem Worker bearbeitet)
</p>
</body>
</html>
</richcontent>
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1704496923552" ID="ID_612925354" MODIFIED="1704505942752" TEXT="Anpassungen im ScheduleSpec (SchedulerAPI) notwendig">
<icon BUILTIN="pencil"/>
<node COLOR="#338800" CREATED="1704496939542" ID="ID_1389691721" MODIFIED="1704505937560" TEXT="Activity-Term nun &#xbb;on-demand&#xab; erzeugen">
<richcontent TYPE="NOTE"><html>
<head/>
<body>
@ -107989,7 +108020,23 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
</p>
</body>
</html></richcontent>
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1704506746469" ID="ID_1135578831" MODIFIED="1704506762835" TEXT="Zeitlimit explizit via API kontrollierbar machen">
<icon BUILTIN="flag-yellow"/>
<node CREATED="1704506817515" ID="ID_170171194" MODIFIED="1704506848881" TEXT="geht das sinnvollerweise?">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<body>
<p>
mu&#223; dann die Info &#252;ber zwei Ebenen durchreichen...?
</p>
</body>
</html>
</richcontent>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1704497136967" ID="ID_273051296" MODIFIED="1704497151404" TEXT="Zeitlimit im NOTIFY auf korrekte Handhabung pr&#xfc;fen">
<icon BUILTIN="flag-yellow"/>
@ -107998,15 +108045,6 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
<icon BUILTIN="flag-yellow"/>
</node>
</node>
<node COLOR="#338800" CREATED="1704497119360" ID="ID_1584751968" MODIFIED="1704500287956" TEXT="Builder-Parameter vorsehen">
<icon BUILTIN="button_ok"/>
<node COLOR="#435e98" CREATED="1704500223713" ID="ID_1326282155" MODIFIED="1704500283727" TEXT="withScheduleDependency &#x27fc; schedDepends_">
<icon BUILTIN="info"/>
</node>
<node COLOR="#435e98" CREATED="1704500233716" ID="ID_901591846" MODIFIED="1704500283727" TEXT="withScheduleNotify &#x27fc; schedNotify_ 0.0 ... 1.0">
<icon BUILTIN="info"/>
</node>
</node>
</node>
</node>
</node>
@ -110626,6 +110664,26 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
</html>
</richcontent>
<icon BUILTIN="messagebox_warning"/>
<node CREATED="1704508579832" ID="ID_940093755" MODIFIED="1704508637214">
<richcontent TYPE="NODE"><html>
<head>
</head>
<body>
<p>
nachdem ich aber nur noch per NOTIFY triggere,
</p>
<p>
ist die beobachtbare Verz&#246;gerung nun im Gegenteil oft zu kurz.
</p>
<p>
Nur an einer Stelle mit vielen aktiven Workern, treten mal wieder 2ms auf
</p>
</body>
</html>
</richcontent>
<icon BUILTIN="messagebox_warning"/>
</node>
</node>
</node>
</node>