fix: run MLLM prefill in thread executor to keep event loop responsive#275
Closed
janhilgard wants to merge 1 commit intowaybarrios:mainfrom
Closed
fix: run MLLM prefill in thread executor to keep event loop responsive#275janhilgard wants to merge 1 commit intowaybarrios:mainfrom
janhilgard wants to merge 1 commit intowaybarrios:mainfrom
Conversation
The MLLM scheduler's _process_loop() was calling self.step() directly on the asyncio event loop. During prefill (which can block for seconds on large prompts), this blocked all other HTTP handlers including /health, causing monitoring dashboards to report the server as unavailable. Apply the same hybrid executor pattern already used by engine_core: prefill-likely steps (waiting requests or partial prefill) run via run_in_executor, while fast decode-only steps remain inline. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
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.
Summary
_process_loop()was callingself.step()directly on the asyncio event loop, blocking all HTTP handlers (including/health) during prefillengine_core: prefill-likely steps run viarun_in_executor, decode-only steps remain inline/healthand other endpoints responsive during long prefillsProblem
When a large prompt arrives, prefill can block the event loop for several seconds. During this time,
/healthreturns no response, causing monitoring dashboards to report the server as unavailable.Test plan
--mllm --continuous-batching/health— confirms 200 responses in ~65-73ms during active inference🤖 Generated with Claude Code