@@ -195,14 +195,27 @@ let private withOverlayOnlyMode (formation: StellarFormation) (coreSets: CoreSet
195195 LogInfo " Disabling overlay-only mode"
196196 toggleOverlayOnlyMode formation coreSets
197197
198- let private readLedgerAgePercentiles ( peer : Peer ) : float * float =
198+ let private readLedgerAgePercentiles ( peer : Peer ) : Peer * float * float =
199199 let h = peer.GetMetrics() .LedgerAgeClosedHistogram
200- float h.`` 75 `` , float h.`` 99 ``
200+ peer, float h.`` 75 `` , float h.`` 99 ``
201+
202+ let private collectLedgerAgePercentiles
203+ ( formation : StellarFormation )
204+ ( coreSets : CoreSet list )
205+ : ( Peer * float * float ) list =
206+ formation.NetworkCfg.PeersInSets( List.toArray coreSets)
207+ |> List.map ( fun peer -> async { return readLedgerAgePercentiles peer })
208+ |> Async.Parallel
209+ |> Async.RunSynchronously
210+ |> Array.toList
201211
202212// Returns true iff every peer's ledger.age.closed-histogram satisfies:
203213// P75 in [0.80*T, 1.20*T)
204214// P99 <= 2*T
205215//
216+ // Snapshot all peers' metrics before evaluating any peer. Core keeps closing
217+ // ledgers after loadgen exits, so serial fetch-and-check skews later peers.
218+ //
206219// FIXME: the P75 tolerance is temporarily widened to +/-20% because
207220// stellar-core currently has perf regressions that prevent the intended
208221// +/-5% band from being achievable. Tighten this back to 0.95/1.05 (or
@@ -213,22 +226,20 @@ let private checkLedgerAgeSLA (formation: StellarFormation) (coreSets: CoreSet l
213226 let tHi = tf * 1.20
214227 let p99Max = tf * 2.0
215228 let mutable ok = true
229+ let percentiles = collectLedgerAgePercentiles formation coreSets
216230
217- formation.NetworkCfg.EachPeerInSets
218- ( List.toArray coreSets)
219- ( fun peer ->
220- let p75 , p99 = readLedgerAgePercentiles peer
221- let peerOk = p75 >= tLo && p75 < tHi && p99 <= p99Max
222-
223- LogInfo
224- " peer=%s T=%d ms p75=%.0f p99=%.0f -> %s "
225- peer.ShortName.StringName
226- targetMs
227- p75
228- p99
229- ( if peerOk then " PASS" else " FAIL" )
230-
231- if not peerOk then ok <- false )
231+ for peer, p75, p99 in percentiles do
232+ let peerOk = p75 >= tLo && p75 < tHi && p99 <= p99Max
233+
234+ LogInfo
235+ " peer=%s T=%d ms p75=%.0f p99=%.0f -> %s "
236+ peer.ShortName.StringName
237+ targetMs
238+ p75
239+ p99
240+ ( if peerOk then " PASS" else " FAIL" )
241+
242+ if not peerOk then ok <- false
232243
233244 ok
234245
0 commit comments