Skip to content

Show concurrency limit on WebUI queue page and in queue_counts table#216

Open
airhorns wants to merge 2 commits intomainfrom
show-floating-limit-webui
Open

Show concurrency limit on WebUI queue page and in queue_counts table#216
airhorns wants to merge 2 commits intomainfrom
show-floating-limit-webui

Conversation

@airhorns
Copy link
Copy Markdown
Contributor

@airhorns airhorns commented Mar 26, 2026

Summary

  • Adds max_concurrency (nullable Int64) and limit_type (nullable Utf8, "fixed"/"floating") columns to the queue_counts query table
  • The WebUI /queue?name=xyz page now shows the current concurrency limit, type, and utilization in a summary bar
  • Works across local and remote shards via the cluster query engine
  • For floating limits, reads from persisted FloatingLimitState; for fixed limits, resolves from job info via concurrency request or lease lookup

Test plan

  • 3 new regression tests for queue_counts (fixed, floating, and mixed queues)
  • All 105 query tests pass
  • All 39 webui tests pass
  • All 16 concurrency tests pass
  • All 21 floating concurrency tests pass
  • Benchmarks added for queue_counts queries in query_performance.rs

🤖 Generated with Claude Code


Note

Medium Risk
Touches enqueue/grant/refresh concurrency paths to populate a new in-memory limit cache used by queries, so mistakes could surface incorrect limits or add contention on hot paths. Changes are additive and guarded (nullable columns), but impact both runtime concurrency management and query/UI output.

Overview
queue_counts now exposes two new nullable columns: max_concurrency and limit_type (fixed/floating), sourced from a new in-memory limit cache rather than DB scans.

Concurrency code paths (enqueue, process_ticket_request_task/grant scanner, and floating-limit refresh success) now populate/snapshot this cache, and the WebUI queue detail page queries queue_counts to show the current limit, type, and utilization. Adds regression tests covering fixed/floating/multi-queue cases plus benchmark queries for the updated queue_counts table.

Written by Cursor Bugbot for commit 5e5f4f8. This will update automatically on new commits. Configure here.

… query table

Add max_concurrency and limit_type columns to the queue_counts query table so
the current concurrency limit for each queue is queryable via SQL. For floating
limits, the value comes from the persisted FloatingLimitState. For fixed limits,
it is resolved from job info via a concurrency request or lease lookup.

The WebUI /queue?name=xyz page now displays the concurrency limit, type
(fixed/floating), and utilization (holders / max) in a summary bar. This works
across local and remote shards since it uses the cluster query engine.

Also adds regression tests for both fixed and floating concurrency limits in the
queue_counts table, and benchmarks for the queue_counts queries used by the WebUI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@airhorns airhorns marked this pull request as ready for review March 26, 2026 11:05
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Instead of scanning floating limit state keys and job info from the DB
to resolve concurrency limits in the queue_counts table, maintain an
in-memory cache in ConcurrencyManager that is populated during enqueue,
grant_next, and floating limit refresh.

This eliminates per-queue DB scans (request prefix scan, lease lookup,
job info read) from the query path, making queue_counts queries purely
in-memory for limit resolution.

Changes:
- Add CachedQueueLimit and ConcurrencyLimitType to ConcurrencyManager
- Cache limits during handle_enqueue (fixed + floating), grant_next,
  handle_request_ticket_task, and report_refresh_success
- QueueCountsScanner reads from snapshot_queue_limits() instead of DB
- Remove now-unused floating_limits_prefix/tenant_prefix key helpers
- Add holder-only test case (no requesters, limit resolved from cache)

Co-Authored-By: Claude Opus 4.6 (1M context) <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.

1 participant