⚡ Bolt: [performance improvement] Limit ingest pipeline LLM extraction concurrency#66
Conversation
What: Wrapped extraction agent `arun` invocations (`_node_extract_profile`, `_node_extract_temporal`, `_node_extract_code`, and `_node_extract_snippet`) inside inline `async def` helper functions bound by an `asyncio.Semaphore(5)`. Why: While `asyncio.gather` successfully parallelized the extraction LLM queries, without an upper bound, long lists of batched queries could simultaneously fire off requests to the LLM backend, running a severe risk of triggering 429 Too Many Requests errors and API rate limits. Impact: Prevents unbounded concurrent requests to external API providers. Sub-queries execute in predictable batches of up to 5, providing steady performance and preventing event loop starvation on massive workloads. Measurement: Validated via `benchmark.py` that for 15 concurrent sub-requests, the execution was properly bounded to exactly 5 concurrent active tasks at peak.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
What:
Wrapped extraction agent
aruninvocations (_node_extract_profile,_node_extract_temporal,_node_extract_code, and_node_extract_snippet) inside inlineasync defhelper functions bound by anasyncio.Semaphore(5).Why:
While
asyncio.gathersuccessfully parallelized the extraction LLM queries, without an upper bound, long lists of batched queries could simultaneously fire off requests to the LLM backend, running a severe risk of triggering 429 Too Many Requests errors and API rate limits.Impact:
Prevents unbounded concurrent requests to external API providers.
Sub-queries execute in predictable batches of up to 5, providing steady performance and preventing event loop starvation on massive workloads.
Measurement:
Validated via a mock
benchmark.pythat for 15 concurrent sub-requests, the execution was properly bounded to exactly 5 concurrent active tasks at peak while successfully allowing parallelism.PR created automatically by Jules for task 472928156518992823 started by @ishaanxgupta