Skip to content

Improve devbox polling: eliminate client-side sleep, enable HTTP/2#793

Merged
jrvb-rl merged 3 commits into
mainfrom
jrvb/fix-polling
May 1, 2026
Merged

Improve devbox polling: eliminate client-side sleep, enable HTTP/2#793
jrvb-rl merged 3 commits into
mainfrom
jrvb/fix-polling

Conversation

@jrvb-rl
Copy link
Copy Markdown
Contributor

@jrvb-rl jrvb-rl commented May 1, 2026

Replace the client-side busy-poll loop (async_poll_until) for await_running with a new retry_server_poll_until that passes the remaining time budget to the server's wait_for_status endpoint as timeout_seconds. This eliminates a 30-second asyncio.sleep() between each long-poll attempt that was causing devbox startup times to cluster at 40s and 80s instead of the actual 3-5s provisioning time.

Enable HTTP/2 by default on AsyncHttpxClient so that concurrent long-poll requests multiplex over fewer TCP connections instead of requiring one connection per in-flight request.

For the Trajectory test, this dramatically improved the results with 494 concurrent devboxes:
Before: p50=40.5s, p90=48.1s, max=80.9s
After: p50=4.4s, p90=9.7s, max=20.6s

Replace the client-side busy-poll loop (async_poll_until) for
await_running with a new retry_server_poll_until that passes the
remaining time budget to the server's wait_for_status endpoint as
timeout_seconds. This eliminates a 30-second asyncio.sleep() between
each long-poll attempt that was causing devbox startup times to cluster
at 40s and 80s instead of the actual 3-5s provisioning time.

Enable HTTP/2 by default on AsyncHttpxClient so that concurrent
long-poll requests multiplex over fewer TCP connections instead of
requiring one connection per in-flight request.

For the Trajectory test, this dramatically improved the results with 494 concurrent devboxes:
  Before: p50=40.5s, p90=48.1s, max=80.9s
  After:  p50=4.4s,  p90=9.7s,  max=20.6s
@jrvb-rl jrvb-rl requested review from dines-rl and james-rl May 1, 2026 19:23
Copy link
Copy Markdown
Contributor

@james-rl james-rl left a comment

Choose a reason for hiding this comment

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

looks great

Comment thread src/runloop_api_client/lib/polling_async.py
@jrvb-rl jrvb-rl merged commit 3fc564d into main May 1, 2026
7 checks passed
@jrvb-rl jrvb-rl deleted the jrvb/fix-polling branch May 1, 2026 20:09
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.

2 participants