fix(grpc-data): size projected unary reservations from the node's shape (#960); per-item status for projected items refused at create (#961)

#960: a projected read reserves 16 KiB for a fixed-size scalar (16 KiB + 256 B/element for a
fixed-length fixed-size array) instead of the whole MaxPendingBytes, so the default 1 MiB admits
64 concurrent scalar reads; String/Bytes/variable arrays keep the whole cap, and a waiting
whole-cap read holds back smaller ones for 100 ms (anti-starvation). Writes reserve
16 KiB + identifiers + 3 x the value bound (what the origin's DataWriteExecutor admits the batch
against). Monitored-item renewals reserve 256 KiB. Measured: 4 x 250 ms maxAge=0 reads 1016 ms /
1 in flight -> 285 ms / 4 in flight.

#961: TryAcquireProjectedItem reports BadResourceUnavailable for a stream-capacity refusal; the
node manager's CreateMonitoredItem override turns the item manager's ServiceResultException into
that item's status (was a whole-request fault), and an authority race is re-classified outside
Lock like the per-item probe.
This commit is contained in:
Joseph Doherty
2026-12-01 20:34:35 -05:00
parent 92da56c071
commit 75e6ff9af8
14 changed files with 644 additions and 48 deletions
+13 -3
View File
@@ -40,9 +40,19 @@ a missing sample or an unsuitable one — is served from a bounded origin read *
request**: the node manager's async Read (`IReadAsyncNodeManager`, no node-manager `Lock` held, no
request thread blocked) reads the origin, serves what it read and publishes it to the cache. The
wait is at most 5 s per request (`OtOpcUaNodeManager.ProjectedOriginReadWait`), less the request
deadline's margin; the reads are admitted against the same unary budget as before (the default
1 MiB `MaxPendingBytes` admits one 1 MiB read at a time) and a batch is pumped through it as reads
complete. A read that is not answered in time, or answers nothing servable (unreachable, not
deadline's margin; the reads are admitted against the same unary budget as before and a batch is
pumped through it as reads complete. **Since #960** each read reserves only what its node's declared
shape can answer — 16 KiB for a fixed-size scalar, 16 KiB + 256 B per element for a fixed-length
array of fixed-size elements — so the default 1 MiB `DataConnections:MaxPendingBytes` admits up to
`MaxConcurrentCalls` (64) scalar reads at once (measured: four 250 ms origin reads in one `maxAge=0`
request, 1016 ms / 1 in flight before, 285 ms / 4 in flight after). A String / Bytes value or a
variable-length array has no declared bound and still reserves the whole per-read cap
(`min(4 MiB, MaxPendingBytes)`), so such reads run one at a time at the default; a read of that kind
that is waiting for capacity holds back smaller reads for 100 ms (re-armed while it waits) so a steady
stream of scalar reads cannot starve it. The reservation is also the read's decode limit, so an
origin answering more than the node's shape allows is refused rather than exceeding the bound. A
projected Write likewise reserves what its value needs (16 KiB + identifiers + 3 × the value's
size bound — the budget the origin admits a write batch against), not the whole cap. A read that is not answered in time, or answers nothing servable (unreachable, not
ready, older than the mapping's stale timeout), returns `BadWaitingForInitialData` as before; a
read never admitted by the deadline is scheduled as before. A lapsed lease is renewed first, in the
same request (see [Data connections](DataConnections.md#subscription-freshness-and-exact-item-renewal)).