Skip to content

server: add pool-max-blocked fields to pending_resources API#2209

Open
sgirones wants to merge 1 commit intomainfrom
salvador/pending-resources-at-max-capacity
Open

server: add pool-max-blocked fields to pending_resources API#2209
sgirones wants to merge 1 commit intomainfrom
salvador/pending-resources-at-max-capacity

Conversation

@sgirones
Copy link
Contributor

@sgirones sgirones commented Mar 5, 2026

Summary

  • When a function/sandbox pool is at max_containers, pending runs in those pools are now excluded from the function_runs and sandboxes histograms in /internal/pending_resources
  • The API now reports only scalable demand (total pending minus blocked-by-max) so the external autoscaler doesn't provision executors that can never take work
  • Adds subtract() method to ResourceProfileHistogram and compute_blocked_by_pool_max() in buffer_reconciler.rs to compute blocked counts on-the-fly at request time
  • Existing field names and semantics for function_pool_deficits / sandbox_pool_deficits are unchanged

Test plan

  • Two new integration tests: test_function_runs_blocked_by_pool_max and test_sandboxes_blocked_by_pool_max
  • cargo +nightly clippy — clean
  • cargo +nightly fmt — clean
  • just check-rust — passes

🤖 Generated with Claude Code

@sgirones sgirones force-pushed the salvador/pending-resources-at-max-capacity branch 3 times, most recently from 39c6703 to 895cc68 Compare March 5, 2026 11:18
@sgirones sgirones marked this pull request as ready for review March 5, 2026 14:11
@sgirones sgirones force-pushed the salvador/pending-resources-at-max-capacity branch 6 times, most recently from 1ae161b to 28e23c4 Compare March 5, 2026 19:20
Copy link
Collaborator

@diptanu diptanu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add some timers in places where we compute deficit to monitor the performance as clusters grow in size or we have a lot of pending work.

let app = state.indexify_state.app_state.load();
let pending = app.indexes.get_pending_resources().clone();
Ok(Json(pending.into()))
let pending = app.indexes.get_pending_resources();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add a timer here to understand how long this takes in production

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a new metric

@sgirones sgirones force-pushed the salvador/pending-resources-at-max-capacity branch 4 times, most recently from 114ad80 to e89c164 Compare March 6, 2026 08:54
When a function pool hits max_containers, the /internal/pending_resources
API now reports only scalable demand (total - blocked-by-max) so the
external autoscaler does not provision executors that can never take work.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.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.

2 participants