Skip to content

feat(file-processors): add async request scheduler to prevent docling…#5627

Draft
alinaryan wants to merge 1 commit intoogx-ai:mainfrom
alinaryan:async-scheduler
Draft

feat(file-processors): add async request scheduler to prevent docling…#5627
alinaryan wants to merge 1 commit intoogx-ai:mainfrom
alinaryan:async-scheduler

Conversation

@alinaryan
Copy link
Copy Markdown
Contributor

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.

  • max_concurrency (default 2): how many requests can be in-flight at once
  • max_queue_size (default 0/unlimited): cap on waiting requests before rejecting

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

…-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>
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