perf(grpc-data): A3 L2 in-process memory harness (1,000 imported conditions, one mapping) + MaxImportedConditionBytes from the measurement (205,665 B × 2,500)

This commit is contained in:
Joseph Doherty
2026-11-24 17:23:40 -05:00
parent 2d0147f9da
commit fecb178efa
3 changed files with 108 additions and 6 deletions
@@ -40,18 +40,25 @@ 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 400 MiB; provisional until L2).</param>
/// <param name="MaxImportedConditionBytes">Per consumer node (default = L2-measured <see cref="BytesPerCondition"/> × 2,500 ≈ 490 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)
{
/// <summary>Counted, not estimated (plan §5.5 table): the worst case per condition.</summary>
public const int NodesPerCondition = 49;
/// <summary>Measured retained managed size per condition (≈ 157 KiB, SDK 2.0.1).</summary>
public const long BytesPerCondition = 160_997;
/// <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.
/// </summary>
public const long BytesPerCondition = 205_665;
/// <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;
public static ProjectedConditionOptions Default { get; } =
new(TimeSpan.FromSeconds(30), 122_500, 400L * 1024 * 1024, TimeSpan.FromSeconds(1));
new(TimeSpan.FromSeconds(30), 122_500, DefaultMaxImportedConditionBytes, TimeSpan.FromSeconds(1));
}
/// <summary>Why a condition-bearing mapping is not contributing conditions.</summary>