diff --git a/docs/deploy/2026-11-21-vd03-perf-r1-r2.md b/docs/deploy/2026-11-21-vd03-perf-r1-r2.md new file mode 100644 index 00000000..09c48e7a --- /dev/null +++ b/docs/deploy/2026-11-21-vd03-perf-r1-r2.md @@ -0,0 +1,72 @@ +# 2026-11-21: DEV vd03 on `3be20983` (R1) then `9a4bc1df` (R2), event-path CPU fixes + +Ring 1 of `docs/plans/2026-11-21-worker-perf-rollout.md` (#236). Owner request: "rollout the updated mxaccessgw to vd03 +and measure performance improvements". Owner chose R1 then R2 on the same day, each one measured, instead of the plan's +48 h soak between them. **No rollback.** vd03 now runs `9a4bc1df`. + +| | | +|---|---| +| Packages | `mxgw-r1-3be20983.zip` sha256 `cd1ec6b4…a91c7fa`; `mxgw-r2-9a4bc1df.zip` sha256 `d7f6c508…c32c622`. Server is a self-contained `win-x64` publish (built on the Mac with SDK 10.0.403, because windev's SDK 10.0.204 bundles runtime 10.0.8, which the script refuses as a downgrade). Runtime 10.0.14 equals live. Worker is built x86 on windev, apphost renamed `MxGateway.Worker.exe`. File layout is identical to `mxgw-e74918cc.zip` | +| Staged | `E:\psrem-stage\mxgw-perf-3be20983\`, `E:\psrem-stage\mxgw-perf-9a4bc1df\` (left in place for rollback) | +| Script | The patched `Upgrade-MxGatewayService.ps1` from `E:\psrem-stage\mxgw-ui-e74918cc\`. It differs from the repo's `4890a3d1` only in the `nssm start` try/catch. Both real runs hit the benign `SERVICE_START_PENDING`, and the patch absorbed it | +| Remote exec | 7 WinRM calls: per release one dry run and one real run, plus three 60 s `typeperf` captures. Everything else was over SMB or HTTP | + +## Deploys + +| | R1 `3be20983` (`perf-r1`) | R2 `9a4bc1df` (`perf-r2`) | +|---|---|---| +| Backup stamp | `20261121-090037` | `20261121-092043` | +| Env block | 9 entries `b697148e6cbc`, unchanged at every step | same | +| Carried | `appsettings.json` (`2B727FE5C90A`, NAM LDAP), `appsettings.Development.json`, `dashboard.pfx` | same hashes | +| Health | `/healthz`, `/health/ready` 200; `/health/active` healthy; 2/2 sessions ready, 0 faulted | same | +| Downtime | ~14 s (14:00:42 → 14:00:56 UTC) | ~12 s (14:20:48 → 14:21:00 UTC) | +| Reconnect | ScadaBridge re-subscribed 810 tags (`AdviseSupervisory` 810) | same | +| Record-info pin | both workers `pinned {77e896ec-…} v3.2 record {a162d9e4-…}` (OTel log export `E:\ApiInstall\OtelCollector\data\logs.jsonl`) | both workers pinned (`logs-2026-11-21T14-22-31.842-size.jsonl`) | + +## Measurement + +The same counter set each time (60 × 1 s), with the event rate taken from the anonymous `/metrics` endpoint +(`mxgateway_events_received_total`) during the capture window. CPU is shown as % of one core; the box has 4 logical CPUs. + +| | Baseline `e74918cc` | R1 | R1 re-run | R2 | +|---|---|---|---|---| +| Event rate (ev/s) | 355.1 | 241.4 | 241.9 | 242.3 | +| Hot worker CPU (user / kernel) | **45.0** (16.0 / 29.1) | **0.3** | 0.4 | 0.6 | +| Hot worker CPU per event | 1.268 ms | 0.013 ms | 0.017 ms | 0.023 ms | +| Hot worker context switches/s | 29,398 | 463 | 478 | 918 | +| Server CPU | **11.3** | **1.2** | 1.0 | 1.4 | +| Server CPU per event | 0.319 ms | 0.048 ms | 0.042 ms | 0.057 ms | +| Server context switches/s | 26,096 | 1,884 | 1,572 | 1,403 | +| System CPU (% of box) / queue length | 57.1 / 10.2 | 37.2 / 5.6 | 39.6 / 3.1 | 47.3 / 5.4 | +| System context switches/s | 131,608 | 44,057 | 48,316 | 56,123 | + +- **R1 meets the plan's pass bar by a wide margin.** The bar was a hot worker at or below 10% of a core. CPU per event + fell about 98% for the worker and about 85% for the Server. The worker gain is much larger than windev's 11×, + as expected, because CrowdStrike makes every registry lookup that the pin removes more expensive on vd03. +- **R2 shows no measurable change on top of R1.** After R1 the Server is already at about 1% of a core, so R2's + difference is within run-to-run noise. +- The higher system CPU in the R2 run comes from other processes on the box. + +## Open: event rate dropped 32% at the R1 restart + +- **Before:** the rate was a flat 356–357 ev/s for at least 1.5 h before the deploy. The old process averaged about + 357/s over its 40 h life. +- **After:** from the R1 restart on it has been a steady 235–245/s, under both R1 and R2. +- **Unchanged across the restart:** `AdviseSupervisory` (810), sessions and workers, the alarm provider mode, and + queue depths (0). +- **Why the build is not the obvious cause:** the windev bench delivered the same rate (~242/s, same totals) on the + old and new worker builds. R1's event path has nothing that drops or merges events. +- **Candidate cause, unconfirmed:** after each reconnect ScadaBridge logged "Seed read returned no value for 298 + tag(s)". 298 of 810 tags is about 37%, close to the 32% drop, so those tags may not be delivering since the + re-subscribe. An earlier restart of the old build was not available to compare against. +- **Gate:** this must be explained before QA (#236). + +## Not done in this window + +- The runbook 7.3 Worker-path read with a pre-existing API key. ScadaBridge's existing key reconnecting and + re-subscribing 810 tags is indirect evidence that the Worker path works. + +## Rollback + +- Back to R1: `Upgrade-MxGatewayService.ps1 -Rollback -BackupStamp 20261121-092043`. +- Back to `e74918cc`: `-BackupStamp 20261121-090037`.