Repository navigation
serve: queue HTTP connection bursts before accept (#267) - #290
Merged
Merged
Conversation
Python 3.10's ThreadingHTTPServer listens with backlog 5, so 16 clients arriving before the accept loop runs get connection resets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Background
During concurrent Qwen3-4B HTTP sweeps (clients=16), the serving process stayed alive but clients got connection resets.
serve_stageusesThreadingHTTPServer, whose default listen backlog on Python 3.10 is 5. The original failing runs showed host listen-drop counters rising (+36 on the GPU route at 2048/128/c16, +82 on the ATOM SSE route at 512/128/c16).Changes
accel/serve/llmd.py: the serving listener subclassesThreadingHTTPServerwithrequest_queue_size = 128.tests/test_http_listener_backlog.py: holds the accept thread back and opens 16 real TCP connections to it.This carries the code change from #289 onto
optimus-rm. The experiment evidence in #289 (JSON summaries, experiment record) stays out of the repository.Verification
llmd.pychange: the new test fails (connection timeout).f52c413+ this change): 264 conditions over Qwen3-4B RNGD→GPU, Gemma3-1B RNGD→GPU and Qwen3-4B ATOM routes, with zero host listen-drop increments and outputs exact-matched within each route.Compatibility and limits
Only the listen backlog changes; admission, timeouts and KV APIs do not. The retries support the backlog as the cause but don't prove it was the only cause of resets. No throughput claim.
Related Issue
Related to #267 (supersedes the code part of #289).
🤖 Generated with Claude Code