3x-ui/internal/web/runtime
BlindMaster24 4a8fdceed6
perf(nodes): reuse one pooled client per node instead of rebuilding it (#6548)
* perf(nodes): reuse one pooled client per node instead of rebuilding it

The heartbeat probe asks for a client every 5s per node, and for skip, pin and
mtls modes HTTPClientForNode built a client with its own transport each time:
every tick paid a full TCP+TLS handshake per node, which is the CPU a 100-node
fleet reports. Cache the client per node identity, close the previous one when
that identity changes, and raise the idle pool caps above any real fleet size
so a node's connection survives to its next tick.

* perf(nodes): keep one client per node in the pooled cache

Round-1 findings on this PR. The eviction dropped only entries whose key did not
start with the current identity, so every proxy variant of that identity stayed
for the life of the process. That variant is often a fresh loopback port:
withOutboundBridge mints one per call and tears the bridge down on return, so
each operator "test node" or remote-inbounds action added a client whose key can
never be hit again, and a node switched to verify mode orphaned its old entry by
returning before the loop. Replacing that filter with one entry per node bounds
the cache at the fleet size, and the verify-mode return now clears the node too.

TestHTTPClientForNodeKeepsOneClientPerNode fails without this -- watched red,
"2, want 1" -- and pins the verify-mode cleanup on the same cache.

* style(nodes): keep the eviction comment inside the two-line cap
2026-09-15 15:29:49 +03:00
..
local.go Feature/tuic v5 (#6337) 2026-09-12 10:15:48 +02:00
manager.go Repo-wide self-correcting audit: 54 verified bug fixes (#5970) 2026-07-17 00:33:06 +02:00
manager_convergence_test.go fix(runtime): refresh cached node remotes on identity change (#5614) 2026-06-28 15:01:18 +02:00
reconcile_skip_test.go fix(node): stop client edits from tearing down node inbounds and harden reconcile fingerprints 2026-07-05 02:06:58 +02:00
remote.go fix(node): let a node-reported tag outrank a stale adopted alias 2026-09-04 02:48:35 +02:00
remote_envelope_test.go feat(node): node hardening — mTLS, hashed+zstd reconcile transport, per-node net metrics (#5382) 2026-06-16 12:19:33 +02:00
remote_mtls_test.go feat(node): node hardening — mTLS, hashed+zstd reconcile transport, per-node net metrics (#5382) 2026-06-16 12:19:33 +02:00
remote_test.go fix(node): let a node-reported tag outrank a stale adopted alias 2026-09-04 02:48:35 +02:00
runtime.go fix(node): fully delete clients on nodes instead of only detaching them 2026-07-05 20:28:26 +02:00
tls_client.go perf(nodes): reuse one pooled client per node instead of rebuilding it (#6548) 2026-09-15 15:29:49 +03:00
tls_client_property_test.go Test-quality audit: fix 2 prod bugs, strengthen weak tests, add mutation/fuzz/CI tooling (#5345) 2026-06-15 15:17:03 +02:00
tls_client_test.go perf(nodes): reuse one pooled client per node instead of rebuilding it (#6548) 2026-09-15 15:29:49 +03:00
tls_client_wire_test.go fix(nodes): apply a rotated master mTLS certificate without restarting the panel (#6194) 2026-08-15 16:03:42 +02:00