Core: Make REST async planning pool bounded and configurable#16332
Open
aamir306 wants to merge 1 commit into
Open
Core: Make REST async planning pool bounded and configurable#16332aamir306 wants to merge 1 commit into
aamir306 wants to merge 1 commit into
Conversation
Replace the single-threaded executor in CatalogHandlers with a bounded thread pool configurable via system property or environment variable. This addresses the server-side scan planning bottleneck flagged by @chenwyi2 in the review of PR apache#14480. Changes: - Add SystemConfigs.REST_ASYNC_PLANNING_THREADS config entry with system property 'iceberg.rest.async-planning-threads' and env var 'ICEBERG_REST_ASYNC_PLANNING_THREADS' - Default pool size is max(2, availableProcessors) - Use ThreadPools.newExitingWorkerPool() for proper shutdown handling - Expose ASYNC_PLANNING_THREADS as public constant for server implementations to access the configured value - Add tests validating configuration properties and defaults Co-authored-by: Cursor <cursoragent@cursor.com>
aamir306
added a commit
to shelf-project/shelf
that referenced
this pull request
May 14, 2026
…ixes - Add TODO-fix-shelf-performance.md with tiered perf improvement plan (honest PhD-grade analysis: 3.5× ceiling, not 20×) - Add docs/upstream/TRINO-CONTRIBUTION-CANDIDATES.md with 5 phases - Add docs/upstream/ICEBERG-CONTRIBUTION-CANDIDATES.md with 4 phases - Fix integration test gating: use `--features integration` cargo flag instead of deprecated SHELF_INTEGRATION=1 env var - Update charts/shelf/values.yaml with admission throttle documentation (SHELF-29 LODC admission is ON by default at 200 MiB/s) Upstream PRs created: - trinodb/trino#29482: Decouple SplitAffinityProvider binding - apache/iceberg#16332: Bounded async planning pool Co-authored-by: Cursor <cursoragent@cursor.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.
Summary
Replaces the unbounded single-thread
ASYNC_PLANNING_POOLinCatalogHandlerswith a bounded, configurable thread pool. This prevents thread exhaustion under high concurrency and allows operators to tune the pool size for their workloads.Motivation
The current
ASYNC_PLANNING_POOLis a single-threaded, unbounded-queue executor:Problems:
Head-of-line blocking – All async planning requests serialize through a single thread, creating a bottleneck for concurrent REST catalog clients.
Unbounded queue growth – Under load, the unbounded queue can grow without limit, consuming memory and increasing latency for queued requests.
No tuning knob – Operators have no way to adjust the pool size for their deployment's characteristics.
Changes
ICEBERG_REST_ASYNC_PLANNING_POOL_SIZEsystem config (default: 4, minimum: 1)ArrayBlockingQueue(256)to prevent runaway queue growthCallerRunsPolicyfor graceful degradation when the queue is fullConfiguration
Test plan
TestAsyncPlanningPoolConfigwith tests for:Compatibility
Made with Cursor