Skip to content

perf(serverless): add opt-in job take-ahead - #808

Open
vavo wants to merge 1 commit into
runpod:mainfrom
vavo:vavo/fix/647-serverless-take-ahead
Open

vavo wants to merge 1 commit into
runpod:mainfrom
vavo:vavo/fix/647-serverless-take-ahead

Conversation

@vavo

@vavo vavo commented Dec 5, 2026 •

Copy link
Copy Markdown

Summary

Closes #647. This revisits the opt-in take-ahead approach previously proposed in #680, which closed without review feedback.

  • Add take_ahead and RUNPOD_TAKE_AHEAD, off by default.
  • After a full take only, request a bounded extra batch while current jobs run. Short takes keep the existing behavior.
  • Keep the local queue sized for the buffer, honor stop signals for held jobs, and disable take-ahead when refresh_worker is configured.

Verification

  • .venv/bin/pytest: 4,861 passed, 8 skipped; 95.61% coverage.
  • .venv/bin/ruff check runpod/serverless/modules/rp_scale.py tests/test_serverless/test_take_ahead.py: passed.
  • The focused scheduler tests exercise the real JobScaler against a scripted queue, including deep and shallow queues and stopping a held job. I did not provision a live endpoint locally; the upstream CI workflow has the repository's e2e job.

@vavo
vavo marked this pull request as ready for review December 5, 2026 21:42

This branch has not been deployed

No deployments
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.

Job-take round trip costs ~500ms with a deep queue, capping saturated worker throughput

1 participant