Repository navigation
Conversation
Member
Author
|
Split into two ticket-scoped PRs so each links its own Linear issue via branch name:
Same commits (independent), rebased on current main. Closing this one in favor of those. |
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.
Two independent performance changes, measured live on Runpod Serverless across all four endpoint kinds (QB/LB × GPU/CPU).
perf(serverless): take the next job while a result uploadsA queue worker held a job's slot until its result POST to
job-donereturned (300–330 ms on every job), even though the platform records the result well before that. The nextjob-takeonly started once the slot freed, so every job queued behind another paid the full upload time again.rp_job.handle_jobtakes an optionalon_result_ready(result)callback, invoked just beforesend_result.JobScaler.handle_jobpasses_release_slotas that callback, only for the built-inhandle_job(a customjobs_handlerkeeps the old behaviour)._release_slotruns the refresh/stopPod check first (preserving the "never take another job while refreshing" guarantee), marks the job as sending its result, removes it fromjob_progress, and wakesget_jobs.run_jobsno longer counts result-sending tasks againstcurrent_concurrency, so a newly taken job starts at once.Measured (4 rounds, a burst of 20 jobs on one warm worker):
delayTime(one at a time)A queued burst of 20 drains about 40% faster; queued jobs wait ~2.9 s less.
perf(apps): vendor fastapi without the [standard] extraEvery app with an
@app.apiresource vendoredfastapi[standard], pulling in pygments, opentelemetry, sentry_sdk, google, dns and fastapi_cloud_cli. The runtime (runpod_sdk_runtime.api.server) imports onlyfastapianduvicorn, and the API images already installfastapi[standard]through sdk-runtime's own dependency.uvicorn still finds uvloop and httptools in the API image's site-packages, because the vendored env is placed ahead of the image's packages, not instead of them.
Measured in the same run:
Risks and things to review
job_in_progress=0: the next job-take reports this while an upload is in flight. The platform handed out jobs normally in every live run.max_concurrency > 1, occupancy now falls at upload time rather than after it. Not separately benchmarked; the bench uses one slot.fastapi[standard]extras being vendored (e.g.python-multipartfor forms) still gets them from the built-in API images. Custom images installrunpod-sdk-runtime, which depends onfastapi[standard]itself.Test plan
make quality-check: 3462 passed, 7 skipped; coverage 95.12%.tests/test_serverless/test_result_overlap.py: runs the realJobScalerover HTTP against a fake ai-api whosejob-donetakes 0.3 s: verifies overlap, no stacking, refresh still stops intake, and that a custom handler keeps its slot. All four fail on main.test_api_runtime_vendors_fastapi_without_the_standard_extra.