Skip to content

[tinker] Survive completion bursts at the socket layer (accept backlog, keep-alive) - #14

Closed
avigyabb wants to merge 1 commit into
avi/stack-3-undelivered-resultfrom
avi/stack-4-server-knobs
Closed

[tinker] Survive completion bursts at the socket layer (accept backlog, keep-alive)#14
avigyabb wants to merge 1 commit into
avi/stack-3-undelivered-resultfrom
avi/stack-4-server-knobs

Conversation

@avigyabb

@avigyabb avigyabb commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Stack 4/7.

uvicorn.run: backlog=SKYRL_HTTP_CONNECTION_LIMIT (50k, as on Chuck's branch; the effective value is capped by net.core.somaxconn, raise it to match) and timeout_keep_alive=75.

With 131072 outstanding samples and 212k-token results, each 2048-result completion burst kept the event loop busy ~16 s; uvicorn's 5 s keep-alive then closed every idle client connection, all clients reconnected at once and the 2048-entry accept backlog overflowed, refusing 109k of 131072 requests. With these settings the same run completed 130917 of 131072 with zero forwarding errors and zero reconnects (earlier runs on the 5 s keep-alive showed hundreds to thousands).

Neither setting is needed for correctness: the SDK retries refused or dropped connections. They avoid the reconnect storm rather than fix a failure, and with the SDK's per-client in-flight cap the burst that overflowed the backlog does not occur. An earlier revision of this PR also exposed sample_max_concurrent_requests from EngineConfig via /client/config; that was dropped as unnecessary (its default equalled the SDK default, and no measured run depended on it).

Stack

  1. [tinker] Route uvicorn's access log to a plain handler instead of Rich #11
  2. [tinker] Forward samples with aiohttp instead of httpx #12
  3. [tinker] Keep an undelivered sample result alive for the SDK's retry #13
  4. [tinker] Survive completion bursts at the socket layer (accept backlog, keep-alive) #14
  5. [tinker] Encode forwarded sample results to proto once and serve them as-is #15
  6. [tinker] Decode vLLM completion bodies straight into numpy with pysimdjson #16
  7. [tinker] Load harness for the API server's sampling path at 131k concurrency #17

🤖 Generated with Claude Code

uvicorn.run: backlog=SKYRL_HTTP_CONNECTION_LIMIT (50k; the effective value is
capped by net.core.somaxconn, raise it to match) and timeout_keep_alive=75s.

With 131072 outstanding samples and 212k-token results each 2048-result
completion burst kept the event loop busy ~16s. uvicorn's 5s keep-alive then
closed every idle client connection during the burst, every client reconnected
at once, and the 2048-entry accept backlog overflowed, so the kernel refused
109k of 131072 requests. Connections now queue in the kernel while the loop is
busy and idle ones survive a burst.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Avi Basnet <avigyabb@stanford.edu>
@avigyabb
avigyabb force-pushed the avi/stack-4-server-knobs branch from 2f94455 to 27c838e Compare September 4, 2026 01:24
@avigyabb avigyabb changed the title [tinker] Configurable SDK sampling cap; survive completion bursts at the socket layer [tinker] Survive completion bursts at the socket layer (accept backlog, keep-alive) Sep 4, 2026
@avigyabb
avigyabb marked this pull request as ready for review September 4, 2026 01:26
@avigyabb

avigyabb commented Sep 5, 2026

Copy link
Copy Markdown
Owner Author

Moved upstream: NovaSky-AI#2163

@avigyabb avigyabb closed this Sep 5, 2026
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.

1 participant