perf(grpc-data): A3b review S5 — BytesPerCondition from the worst-case L2 harness (max 228,353 B ⇒ 230,000; cap ≈ 548 MiB)

This commit is contained in:
Joseph Doherty
2026-11-24 20:05:26 -05:00
parent 72dece7f45
commit e5e0780f5e
2 changed files with 5 additions and 4 deletions
@@ -21,7 +21,7 @@ public sealed class DataConnectionOptions
public long MaxTransportBytes { get; set; } = 64 * 1024 * 1024;
/// <summary>A3 (§5.5): imported-condition node budget per consumer node (2,500 × 49 worst-case nodes per condition).</summary>
public int MaxImportedConditionNodes { get; set; } = 122_500;
/// <summary>A3 (§5.5): imported-condition memory budget per consumer node (§9.3 L2: measured 205,665 B/condition × 2,500 ≈ 490 MiB).</summary>
/// <summary>A3 (§5.5): imported-condition memory budget per consumer node (§9.3 L2: worst-case measured 230,000 B/condition × 2,500 ≈ 548 MiB).</summary>
public long MaxImportedConditionBytes { get; set; } = ZB.MOM.WW.OtOpcUa.Runtime.DataConnections.ProjectedConditionOptions.DefaultMaxImportedConditionBytes;
public long MaxPendingBytes { get; set; } = 1024 * 1024;
public TimeSpan MaxSessionLifetime { get; set; } = TimeSpan.FromHours(1);
@@ -40,7 +40,7 @@ public sealed class DeployedConditionMappings : IProjectedConditionMappings
/// <summary>A3 host limits (§5.5 "Budget").</summary>
/// <param name="Linger">How long a connection's condition items stay open after the last event item goes (default 30 s).</param>
/// <param name="MaxImportedConditionNodes">Per consumer node (default 122,500 = 2,500 × 49).</param>
/// <param name="MaxImportedConditionBytes">Per consumer node (default = L2-measured <see cref="BytesPerCondition"/> × 2,500 ≈ 490 MiB).</param>
/// <param name="MaxImportedConditionBytes">Per consumer node (default = L2-measured <see cref="BytesPerCondition"/> × 2,500 ≈ 548 MiB).</param>
/// <param name="ReconnectDelay">Pause before re-opening an ended condition stream.</param>
public sealed record ProjectedConditionOptions(TimeSpan Linger, int MaxImportedConditionNodes, long MaxImportedConditionBytes,
TimeSpan ReconnectDelay)
@@ -50,9 +50,10 @@ public sealed record ProjectedConditionOptions(TimeSpan Linger, int MaxImportedC
/// <summary>
/// Retained managed bytes per imported condition, measured by the A3 L2 harness (1,000 conditions in one mapping on a
/// running SDK 2.0.1 server: node + children + ids + registry/indexes + EventId registry + verdict cache; X0's
/// node-only harness measured 160,997). The managed-heap figure is used: it is higher than the working-set growth.
/// node-only harness measured 160,997). A3b review S5: the WORST case — two placements, all 32 EventId slots, three
/// event items, the runner's Live + Buffer records — max of three runs 228,353 B (managed heap), rounded up.
/// </summary>
public const long BytesPerCondition = 205_665;
public const long BytesPerCondition = 230_000;
/// <summary>§9.3 L2: the host byte cap = measured per-condition bytes × 2,500 (the host condition cap).</summary>
public const long DefaultMaxImportedConditionBytes = BytesPerCondition * 2_500;