Skip to content

perf: investigate and reduce networking latency during onboard and validation #2001

Description

@ericksoa

Problem

Multiple PRs have independently worked around slow networking by bumping timeouts, adding retries, and inserting sleep delays. Each fix addresses a symptom, but the cumulative effect is a fragile onboard experience that breaks on slower hardware and adds minutes of wall-clock time on every platform.

Examples:

As @brandonpelfrey noted in #1998: "Across multiple PRs from different folks I'm seeing things like add 10 seconds here and there so $thing doesn't time out. Want to make sure we're questioning why networking seems to be so fiddly." These timeout bumps are fragile — they work on the machines that were tested but will break on slower hardware.

Scope

This is a diagnostic and optimization effort, not a single bug fix. The goal is to understand why networking is slow and fix root causes rather than continuing to widen timeouts.

Phase 1: Diagnose

  • Profile the onboard network path end-to-end on native Linux, macOS, and WSL2: where is time actually spent?
  • Measure DNS resolution latency inside the k3s container vs. on the host — is CoreDNS adding overhead?
  • Measure TLS handshake time for inference provider endpoints from inside the sandbox vs. from the host
  • Determine whether the L7 proxy (gateway) adds measurable latency to inference validation probes
  • Check if host.openshell.internal resolution is slow on WSL2 (goes through Windows DNS?)
  • Profile the sleep() calls — which are covering real async settling vs. papering over race conditions?

Phase 2: Optimize

Based on diagnosis, potential fixes (non-exhaustive):

  • DNS caching/preflight: Pre-resolve and cache provider DNS during onboard before validation probes hit the gateway
  • Connection reuse: Validation probes currently spawn a new curl per attempt — a persistent connection (or at least keepalive) would skip repeated TCP+TLS handshakes
  • Parallel health checks: Some sequential polling loops could overlap (e.g., gateway health + sandbox ready + dashboard ready)
  • Reduce gateway round-trips: Validation probes go host → gateway → provider. If the gateway adds overhead, consider a direct probe option for validation only
  • Replace sleeps with event-driven waits: Many sleep(2) calls are waiting for a process or pod state — replace with kubectl wait, readiness probes, or file watches where possible
  • Platform-aware defaults: Instead of doubling timeouts for WSL2 as a special case, consider adaptive timeouts that measure the first probe latency and scale subsequent timeouts accordingly

Phase 3: Harden

  • Add onboard timing telemetry (opt-in) so we can see real-world latency distributions
  • Set a performance budget: onboard on a warm system with cached images should complete in < N seconds
  • Add CI timing regression tests that fail if onboard wall-clock exceeds the budget

Current timeout inventory

Location Current value Why
Validation probe (onboard.ts) 10s connect / 15s total (20/30 on WSL2) Inference provider reachability
HTTP probe default (http-probe.ts) 10s connect / 60s total Streaming inference responses
Local provider health (local-inference.ts) 3s connect / 5s total Ollama/vLLM liveness
Gateway liveness (nemoclaw.ts) 3s max Quick gateway up/down check
ARM64 health poll 30 × 10s = 300s k3s slow init on ARM
WSL2 sandbox ready 30 × 2s = 60s Pod init under Docker Desktop
Ollama model pull 600s (10 min) Large model download
OpenShell install 300s (5 min) Binary download + extract

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

NV QABugs found by the NVIDIA QA TeamUATIssues flagged for User Acceptance Testing.VDRLinked to VDR findingarea: performanceLatency, throughput, resource use, benchmarks, or scalingplatform: wslAffects Windows Subsystem for Linux

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions