perf(clients): batch client creation by destination node (#7367)

Group compatible client creates by destination and effective payload via the existing clients/add API. Resolve node-local inbound IDs, preserve distinct flow/address/credential payloads, bound delivery concurrency and use a shared four-second remote delivery budget after local commits.

Advance reconciliation fingerprints only for acknowledged intended settings, retaining previous-fingerprint CAS rather than stamping unrelated rebased changes. Preserve FIFO turns, node-wide barriers, dirty generations, durable delete supersession, partial and uncertain delivery recovery and downstream outcomes. Protect later reattachments in final Delete cleanup and complete Create metadata before remote delivery.

Validation: all 12 CI jobs passed on 63e70cda38 (run 46935177853). PostgreSQL logs confirm 21 ordering/grouped-create tests and prior reporter-lock, reconciliation and traffic contention gates; node E2E confirms all four version pairings. Author reports SQLite/PostgreSQL race tests, make verify and isolated full make race.

Author-reported paired PostgreSQL 18 benchmark: 11 -> 1 RPC, fixed 200 ms peer delay 11-target p95 1552.0 -> 731.9 ms, timeout probe 12.41–12.42 -> 4.41–4.50 s. Size-dependent peer cost can instead cause pending delivery (1.74 -> 4.51 s with 0.74 s recovery); four stalled nodes can defer a fifth. Monitor production convergence and pending rate. No general production latency or allocation improvement claimed.

Refs #7299
This commit is contained in:
Hamed
2026-12-03 00:08:12 +03:30
committed by GitHub
parent 32e4b8bcfe
commit 91d5ff400d
13 changed files with 1521 additions and 59 deletions
+1 -1
View File
@@ -269,7 +269,7 @@ func (a *ClientController) create(c *gin.Context) {
return
}
clientSvc := a.clientService.TrackNodeApplies()
needRestart, err := clientSvc.Create(&a.inboundService, &payload)
needRestart, err := clientSvc.CreateWithContext(c.Request.Context(), &a.inboundService, &payload)
// Flagged before the error check: a partly-applied create leaves clients
// committed on the inbounds that succeeded, and those still need the restart.
if needRestart {