feat(file-processors): add async request scheduler to prevent docling…#5627
Draft
alinaryan wants to merge 1 commit intoogx-ai:mainfrom
Draft
feat(file-processors): add async request scheduler to prevent docling…#5627alinaryan wants to merge 1 commit intoogx-ai:mainfrom
alinaryan wants to merge 1 commit intoogx-ai:mainfrom
Conversation
…-serve overload Docling Serve degrades severely under concurrent load — latency triples for small files, and large image-heavy PDFs crash the server entirely at concurrency >= 5. This adds an AsyncRequestScheduler utility that limits concurrent requests via an asyncio semaphore with FIFO queuing, and integrates it into the docling-serve file processor provider. Operators can tune max_concurrency (default 2) and max_queue_size (default unlimited) via provider config or environment variables. Signed-off-by: Alina Ryan <aliryan@redhat.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.
What does this PR do?
Adds an AsyncRequestScheduler utility and integrates it into the remote::docling-serve file processor to prevent server overload under concurrent load.
Problem: Benchmarking showed that Docling Serve degrades severely under concurrency — latency triples for small files (6s → 18s), and large image-heavy PDFs crash the server entirely
at concurrency ≥ 5. Without request queuing, a burst of file uploads can take down the processing pipeline.
Solution: A reusable AsyncRequestScheduler (asyncio semaphore with FIFO queuing) that gates how many requests hit the backend simultaneously. The docling-serve provider wraps its HTTP
calls through the scheduler, so excess requests wait in line rather than overwhelming the server.
The scheduler is a general-purpose utility in providers/utils/ — any provider with a resource-constrained backend can adopt it.
Follows up on: #3970 and #5412
Test Plan
In progress