Skip to content

perf(net): reduce health-check probe and reconfiguration overhead - #745

Open
Patrick W. Healy (phealy) wants to merge 3 commits into
mainfrom
phealy/net-healthcheck-efficiency
Open

Patrick W. Healy (phealy) wants to merge 3 commits into
mainfrom
phealy/net-healthcheck-efficiency

Conversation

@phealy

@phealy Patrick W. Healy (phealy) commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Third production-only efficiency layer, based on #744.

Stack: #731 -> #743 (status collection) -> #744 (status transport/controller memory) -> #745 (this PR).

  • Spread initial probes and transmit-interval changes using a deterministic directed-peer phase instead of synchronized starts.
  • Update settings in live health-check sessions rather than recreating goroutines/timers and losing health state, counters, RTT, uptime, or flap history.
  • Pass freshly resolved health profiles into tunnel reconciliation. An explicitly disabled governing profile prevents fallback.
  • Preserve fix(net): validate OIDC pod bindings against informer caches #731's routing rollback, localCIDR handling, and GatewayPoolPeering protocol precedence.
  • Include focused unit/race coverage, CLI/API documentation, and regenerated CRD descriptions. No simulator or e2e files are included.

Intentional behavior change

Default transmit and receive intervals increase from 1s to 15s, reducing default probe traffic and processing. With the unchanged detect multiplier of 3, the nominal detection timeout increases from 3s to 45s; timer checks can add another half-timeout. Explicit interval overrides remain honored for deployments requiring faster detection.

Settings-only changes preserve live session state. Shortening a healthy session's timeout provides a bounded transition window for a reply under the new cadence. Changing the overlay IP still replaces the session.

Validation

  • Scoped formatting, lint, actionlint, normal tests, race tests, and builds passed before stacking.
  • Regenerated the five consuming Site/net CRDs using the pinned controller-gen; repeat generation was idempotent and schema changes are documentation-only.
  • After rebasing onto perf(net): reduce status transport and controller memory overhead #744, combined race-enabled tests passed for healthcheck, node, controller, shared status, net CLI, and both affected API packages.
  • Combined scoped lint and node/controller/kubectl builds passed with a clean worktree.

This PR does not claim a measured whole-cluster CPU or RSS reduction. It reduces probe cadence and session churn while documenting the responsiveness tradeoff.

@phealy
Patrick W. Healy (phealy) requested a review from a team as a code owner September 16, 2026 19:59
@phealy
Patrick W. Healy (phealy) added this pull request to stack #730 September 16, 2026 20:13
This was referenced Sep 16, 2026
@phealy
Patrick W. Healy (phealy) force-pushed the phealy/net-healthcheck-efficiency branch from 44f49cc to 4e21ec9 Compare September 17, 2026 19:16
@phealy
Patrick W. Healy (phealy) force-pushed the phealy/net-healthcheck-efficiency branch 2 times, most recently from c733943 to f93829f Compare September 17, 2026 21:01
@phealy
Patrick W. Healy (phealy) force-pushed the phealy/net-healthcheck-efficiency branch from f93829f to 1eaf3f5 Compare September 17, 2026 21:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Successive reconfigurations can retain stale detection grace beyond the current settings, and public reference documentation remains inconsistent.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Reduces network health-check overhead while preserving live session state during reconfiguration.

Changes:

  • Raises default probe intervals to 15s and phases probe scheduling.
  • Applies profile updates to active sessions with validation and fallback handling.
  • Updates tests, CLI help, API descriptions, CRDs, and documentation.
File summaries
File Description
internal/net/healthcheck/types.go Updates defaults and validates settings.
internal/net/healthcheck/session.go Reconfigures live timers and sessions.
internal/net/healthcheck/reconfiguration_test.go Tests live reconfiguration.
internal/net/healthcheck/probe_phase.go Computes deterministic probe phases.
internal/net/healthcheck/probe_phase_test.go Tests phase distribution and timing.
internal/net/healthcheck/manager.go Preserves sessions during updates.
docs/net/configuration.md Documents health-check behavior.
docs/net/architecture.md Updates architecture defaults.
deploy/net/crd/net.unbounded-cloud.io_sitepeerings.yaml Updates generated interval descriptions.
deploy/net/crd/net.unbounded-cloud.io_sitegatewaypoolassignments.yaml Updates generated interval descriptions.
deploy/net/crd/net.unbounded-cloud.io_gatewaypools.yaml Updates generated interval descriptions.
deploy/net/crd/net.unbounded-cloud.io_gatewaypoolpeerings.yaml Updates generated interval descriptions.
deploy/machina/crd/unbounded-cloud.io_sites.yaml Updates generated interval descriptions.
cmd/unbounded-net-node/wireguard_config.go Applies fresh profiles to WireGuard peers.
cmd/unbounded-net-node/tunnel_config.go Applies profiles to shared tunnels.
cmd/unbounded-net-node/site_watch_reconcile.go Resolves disabled and fresh profiles.
cmd/unbounded-net-node/site_routing_reconcile_test.go Adapts reconciliation tests.
cmd/unbounded-net-node/reconciliation_helpers.go Updates profile comparison and disabling.
cmd/unbounded-net-node/reconciliation_helpers_test.go Updates profile expectations.
cmd/unbounded-net-node/peer_healthcheck.go Resolves and registers profile settings.
cmd/unbounded-net-node/peer_healthcheck_test.go Tests profile precedence and freshness.
cmd/unbounded-net-node/main_update_test.go Adapts configuration test hooks.
cmd/unbounded-net-node/gateway_pool_peering_protocol_test.go Adapts protocol tests.
cmd/unbounded-net-node/cni_reconcile_test.go Adapts CNI reconciliation tests.
cmd/kubectl-unbounded/app/net/create.go Documents inherited CLI defaults.
cmd/kubectl-unbounded/app/net/create_test.go Tests CLI default preservation.
api/net/v1alpha1/types.go Documents API interval defaults.
Review details

Suppressed comments (1)

docs/net/configuration.md:383

  • The newly documented precedence and disabled-fallback behavior conflicts with both custom-resource references: docs/net/custom-resources.md:565-579 and docs/content/reference/networking/custom-resources.md:390-398 still describe the old gateway fallback order and omit the explicit-disable rule. Update those pages with the same resolved-scope semantics.
For mesh peers, an explicit gateway-pool or pool-peering profile wins, followed by a `SiteGatewayPoolAssignment`, a `SitePeering`, and then the peer's `Site`.
For node-to-gateway peers, the node's site/pool assignment governs; gateway nodes use their explicit peer profile or the peer's pool profile, with a remote-site/pool assignment as fallback.
Shared-tunnel gateway peers may fall back to the local site's profile when no governing association exists; WireGuard gateway peers do not use that site fallback.
An explicitly disabled governing profile blocks every fallback.
  • Files reviewed: 27/27 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/net/healthcheck/session.go Outdated
Comment thread docs/net/configuration.md
Base automatically changed from phealy/net-status-transport-efficiency to main September 18, 2026 20:45
Spread initial and updated probe cadences by directed peer identity. Apply resolved profiles in place without losing health state, counters, or flap history; disabled associations block fallback. Default to 15s probes and document the nominal 45s failure-detection tradeoff while retaining explicit overrides.

Preserve the newer routing rollback, localCIDRs, and gateway-pool peering protocol precedence. Adapt newer routing/protocol test callback signatures without changing their assertions. Regenerate the five consuming CRDs using controller-gen v0.21.0; only default documentation changes result. No simulator, e2e, or status transport/collection changes.

Validated: scoped make fmt and make lint; go test for internal/net/healthcheck, cmd/unbounded-net-node, cmd/kubectl-unbounded/app/net, api/net/v1alpha1, api/machina/v1alpha3; go test -race for healthcheck, node, and net CLI; go build for affected production packages and kubectl-unbounded; repeat API generation is idempotent.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d2243398-6c36-4c3d-969e-7ed7bfb5b459
Rebound active timeout-transition grace when cadence settings change and align public reference defaults and precedence documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@phealy
Patrick W. Healy (phealy) force-pushed the phealy/net-healthcheck-efficiency branch from d41d566 to 3e71c03 Compare September 18, 2026 20:45
Comment thread cmd/kubectl-unbounded/app/net/create.go Outdated
Document the inherited detect multiplier and explain how receive and transmit intervals determine the down timeout.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 07b1482a-4420-4169-8102-a2d2026849e4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants