perf(grpc-data): A3 r2 L2 — EventId window back to the plan's 8; measure the retained heap, not GC.GetTotalMemory
GC.GetTotalMemory on .NET 10 regions reported +92 or +218 MiB (bimodal) for the same state; GCMemoryInfo heap size and a heap dump (136 MB of objects, eeheap allocated 136,318,696 / committed 236,208,128) show the extra was committed-but-free regions. The harness now takes HeapSizeBytes-FragmentedBytes after a full blocking GC and the settled working set, and asserts BOTH <= 200 MiB. Worst case (2 placements, 8 slots, 3 event items, Live+Buffer): heap +106.5 MiB, WS +151.3 MiB max of 3 runs. BytesPerCondition 230,000 -> 160,000 (max WS/condition 158,629, rounded up); MaxImportedConditionBytes default 160,000 x 2,500 = 400,000,000 B (~381 MiB).
This commit is contained in:
@@ -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: worst-case measured 230,000 B/condition × 2,500 ≈ 548 MiB).</summary>
|
||||
/// <summary>A3 (§5.5): imported-condition memory budget per consumer node (§9.3 L2: worst-case measured 160,000 B/condition × 2,500 ≈ 381 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);
|
||||
|
||||
@@ -72,8 +72,12 @@ public sealed record ImportedConditionBinding(string ConnectionId, string Condit
|
||||
/// </summary>
|
||||
internal sealed class ProjectedConditionRegistry
|
||||
{
|
||||
/// <summary>Recent EventIds kept per condition for N6 re-binding.</summary>
|
||||
internal const int RecentEventIds = 32;
|
||||
/// <summary>
|
||||
/// Recent EventIds kept per condition (§5.6 step 3: "within its last N (default 8) events"). A3 review round 2: back to
|
||||
/// the plan's 8 — A3a's 32 had no recorded need (validity is "minted under the current marker", which only the newest
|
||||
/// few can satisfy; an older EventId already answers <c>BadEventIdUnknown</c> at the origin).
|
||||
/// </summary>
|
||||
internal const int RecentEventIds = 8;
|
||||
|
||||
private readonly ConcurrentDictionary<NodeId, ImportedCondition> _byNode = new();
|
||||
private readonly ConcurrentDictionary<AlarmConditionState, ImportedCondition> _byInstance = new(ReferenceEqualityComparer.Instance);
|
||||
|
||||
@@ -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 ≈ 548 MiB).</param>
|
||||
/// <param name="MaxImportedConditionBytes">Per consumer node (default = L2-measured <see cref="BytesPerCondition"/> × 2,500 ≈ 381 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,10 +50,12 @@ 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). 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.
|
||||
/// node-only harness measured 160,997). A3b review S5: the WORST case — two placements, every EventId slot, three
|
||||
/// event items, the runner's Live + Buffer records. A3 review round 2: measured with the retained heap
|
||||
/// (<c>GCMemoryInfo</c>, not <c>GC.GetTotalMemory</c>, which counted ~125 MiB of committed-but-free regions) and the
|
||||
/// settled working set, 8 EventId slots (§5.6): max of three runs = 158,629 B (working set; heap 111,715 B), rounded up.
|
||||
/// </summary>
|
||||
public const long BytesPerCondition = 230_000;
|
||||
public const long BytesPerCondition = 160_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;
|
||||
|
||||
Reference in New Issue
Block a user