Repository navigation
Conversation
Prepare bounded, default-off first-hop connections through supported HTTP transport dial hooks. Preserve authentication, TLS trust, proxy routing, streaming and ordinary idle reuse. Add bounded lifecycle observability and synthetic socket and worker integration coverage. Fixes NVIDIA#2967 Signed-off-by: sytianhe <605748+sytianhe@users.noreply.github.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
Add default-off callback connection preparation so a stateless HTTP worker can overlap first-hop DNS/TCP/TLS setup with function execution. The existing HTTP transport still performs the normal authenticated callback POST and owns subsequent connection reuse.
Additional Details
The callback route is available before function execution, but cold callback connection setup currently begins when response headers become available. This change can move that setup off the response-delivery path without changing the invocation service or sending an early HTTP request.
NVCF_CALLBACK_PRECONNECT_ENABLED=trueenables the feature per utility. A bounded pool coalesces preparation by target origin and full proxy identity. The transport's supported dial hooks claim prepared connections only for response POSTs, after ordinary idle reuse has had priority. Request-data GETs cannot consume them.The initial limits are 16 unclaimed preparation entries, a 2-second setup budget, a 30-second unused lifetime, and a bounded cooldown limiting preparation starts. A claimed connection transfers to real callback work; these are speculative-entry limits, not an active-request concurrency limit. Cancellation, expiry, unexpected data and peer close release unused sockets. Missing or failed preparation falls back to normal dialing without replaying the POST.
The implementation preserves the current proxy CA trust configuration and HTTP/1 callback behavior. It adds setup/TLS spans, a prepared-connection claim event, structured context and bounded, pre-initialized lifecycle metrics. Expected cancellation is distinct from setup failure. No callback URL, token or payload is added to feature logs or metric labels.
No third-party dependency versions, licenses or NOTICE entries change.
For the Reviewer
This is a draft for maintainer design review. Review socket ownership during cancellation and handoff, proxy/target isolation, idle reuse, and the initial resource limits.
Waiting for an unfinished preparation can add its remaining setup budget before fallback. Long function execution can outlive an unused prepared socket. The default remains disabled pending workload qualification. Local synthetic tests do not establish deployment-wide latency savings or zero resource overhead.
For QA
Local validation passed:
bazel build //src/clis/nvcf-cli:nvcf-cli.bazel test //src/compute-plane-services/worker-utils/worker/httpstream:httpstream_test../test-callback-preconnect.sh callback../test-callback-preconnect.sh all.git diff --check.The tests use generated certificates, synthetic tokens, loopback HTTP/TLS servers and embedded NATS. Coverage includes proxy and target CA trust, buffered and streaming responses, route isolation, idle reuse, fallback, cancellation, expiry and concurrency. The injected-delay experiment checks prepared-socket consumption and reports timing without a wall-clock correctness threshold. No live requests or deployment-specific results are included.
The full repository suite and a full self-managed stack were not run.
Full-stack deployment and live traffic qualification remain necessary before enabling this outside a test environment. Stateful session and task execution are outside this HTTP callback feature.
Issues
Fixes #2967
Checklist