perf(runtime): split trigger evals from the blocking pool; bounded, deadline-aware execution

This commit is contained in:
Joseph Doherty
2026-08-14 22:36:15 -04:00
parent 312216ff2b
commit c4fc1f8ecd
42 changed files with 3673 additions and 1251 deletions
@@ -39,7 +39,28 @@ public sealed class SiteRuntimeOptionsValidator : OptionsValidatorBase<SiteRunti
builder.RequireThat(options.ScriptExecutionThreadCount > 0,
$"ScadaBridge:SiteRuntime:ScriptExecutionThreadCount must be greater than 0 " +
$"(was {options.ScriptExecutionThreadCount}); it sizes the dedicated script-execution scheduler.");
$"(was {options.ScriptExecutionThreadCount}); it is the FLOOR for the dedicated script-execution scheduler.");
builder.RequireThat(options.ScriptExecutionMaxThreadCount >= options.ScriptExecutionThreadCount,
$"ScadaBridge:SiteRuntime:ScriptExecutionMaxThreadCount must be >= ScriptExecutionThreadCount " +
$"(was {options.ScriptExecutionMaxThreadCount} vs {options.ScriptExecutionThreadCount}); it is the " +
"CEILING for the instance-scaled script-execution pool and a ceiling below the floor would " +
"silently shrink the configured pool.");
builder.RequireThat(options.TriggerEvalMaxConcurrency > 0,
$"ScadaBridge:SiteRuntime:TriggerEvalMaxConcurrency must be greater than 0 " +
$"(was {options.TriggerEvalMaxConcurrency}); it gates concurrent trigger-expression evaluations " +
"and a zero gate would park every Expression trigger on the node forever.");
builder.RequireThat(options.TriggerEvalTimeoutSeconds > 0,
$"ScadaBridge:SiteRuntime:TriggerEvalTimeoutSeconds must be greater than 0 " +
$"(was {options.TriggerEvalTimeoutSeconds}); it bounds a single trigger-expression evaluation " +
"(measured from enqueue, so it also bounds gate-wait time).");
builder.RequireThat(options.MaxConcurrentRunsPerScript > 0,
$"ScadaBridge:SiteRuntime:MaxConcurrentRunsPerScript must be greater than 0 " +
$"(was {options.MaxConcurrentRunsPerScript}); it caps concurrent runs per script and a zero cap " +
"would shed every trigger.");
builder.RequireThat(options.MirroredAlarmCapPerSource > 0,
$"ScadaBridge:SiteRuntime:MirroredAlarmCapPerSource must be greater than 0 " +