Skip to content

Implement concurrency limits plugin#22312

Open
bpatelcs wants to merge 6 commits into
opensearch-project:mainfrom
bpatelcs:concurrency-limits
Open

Implement concurrency limits plugin#22312
bpatelcs wants to merge 6 commits into
opensearch-project:mainfrom
bpatelcs:concurrency-limits

Conversation

@bpatelcs

@bpatelcs bpatelcs commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a new concurrency-limit module that provides adaptive per-action concurrency limiting for OpenSearch. Operators can dynamically configure concurrency limits on any transport action (e.g., search, bulk) via cluster settings — no code changes required to protect new actions.

Key features

  • Adaptive algorithms: Vegas (TCP-Vegas-based, default), Gradient2, and AIMD — powered by Netflix's concurrency-limits library
  • Three operating modes: disabled (default), monitor_only (tracks metrics without rejecting), enforced (actively rejects with HTTP 429)
  • Burst capacity: Optional burst headroom above the adaptive base limit, with a configurable close/open state machine to absorb transient spikes
  • Vegas baseline poisoning protection: Probe-based RTT baseline resets are gated by a configurable inflight threshold (vegas.baseline_reset_load_threshold), preventing heavy-load latency from corrupting the no-load baseline and causing a feedback loop
  • Increase/decrease hysteresis: Configurable consecutive-sample thresholds (vegas.increase_barrier, vegas.decrease_barrier) to dampen limit oscillation
  • Request partitioning: Divide the total limit across named sub-pools (e.g., premium/standard) using pluggable resolvers (byHeader, fixed, bySearchType)
  • Warmup period: Configurable grace period after (re)configuration during which requests are not rejected, allowing the algorithm to calibrate
  • _nodes/stats integration: Limiter state (current limit, in-flight, total rejected, RTT) exposed under concurrency_limiters in the node stats API
  • Push telemetry: Observable gauges registered via MetricsRegistry mirror the pull-path stats for monitoring systems

Configuration example

PUT /_cluster/settings
{
  "persistent": {
    "concurrency_limit.action.search.action_name": "indices:data/read/search",
    "concurrency_limit.action.search.mode": "enforced",
    "concurrency_limit.action.search.algorithm": "vegas",
    "concurrency_limit.action.search.limit.initial": 20,
    "concurrency_limit.action.search.limit.max": 200,
    "concurrency_limit.action.search.vegas.baseline_reset_load_threshold": 0.5,
    "concurrency_limit.action.search.burst.capacity": 10,
    "concurrency_limit.action.search.burst.close_after": 5,
    "concurrency_limit.action.search.burst.open_after": 5
  }
}

Files changed

  • New module modules/concurrency-limit/ — 8 source files, 6 test files, build.gradle, third-party licenses
  • Server integration — NodeStats, NodeService, Node, NodesStatsRequest, TransportNodesStatsAction, TransportClusterStatsAction updated to plumb concurrency_limiter stats (version-gated to V_3_8_0)
  • SPI interface — ConcurrencyLimiterStatsPlugin for decoupled stats collection
  • Test framework — MockInternalClusterInfoService, InternalTestCluster updated for new NodeStats constructor parameter

Test plan

  • ./gradlew :modules:concurrency-limit:check — precommit, unit tests, spotless, missingJavadoc, thirdPartyAudit all pass
  • Manual verification: start a node, configure a limiter via cluster settings, confirm _nodes/stats?metric=concurrency_limiter returns limiter state

Related Issues

Resolves #22295

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: bhavik.patel <bhavik.patel@uber.com>
@bpatelcs bpatelcs requested a review from a team as a code owner June 24, 2026 23:42
@github-actions github-actions Bot added discuss Issues intended to help drive brainstorming and decision making enhancement Enhancement or improvement to existing feature or request RFC Issues requesting major changes Search:Resiliency labels Jun 24, 2026
@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

PR Code Analyzer ❗

AI-powered 'Code-Diff-Analyzer' found issues on commit 08aea12.

PathLineSeverityDescription
gradle/libs.versions.toml23highNew third-party dependency version entry added: 'netflix_concurrency_limits = "0.4.0"' introduces com.netflix.concurrency-limits into the dependency catalog. Per mandatory supply chain rules, any new dependency must be flagged regardless of apparent legitimacy — namespace hijacking and typosquatting are common attack vectors.
modules/concurrency-limit/build.gradle17highNew implementation dependency declared: 'com.netflix.concurrency-limits:concurrency-limits-core:0.4.0'. This pulls a new external artifact into the build. The SHA1 file (9bf32c330cad19a6e564b460a65132aa765b6440) provides a checksum but cannot verify artifact authenticity or supply chain integrity — maintainers must independently verify the artifact origin and contents.

The table above displays the top 10 most important findings.

Total: 2 | Critical: 0 | High: 2 | Medium: 0 | Low: 0


Pull Requests Author(s): Please update your Pull Request according to the report above.

Repository Maintainer(s): You can bypass diff analyzer by adding label skip-diff-analyzer after reviewing the changes carefully, then re-run failed actions. To re-enable the analyzer, remove the label, then re-run all actions.


⚠️ Note: The Code-Diff-Analyzer helps protect against potentially harmful code patterns. Please ensure you have thoroughly reviewed the changes beforehand.

Thanks.

bpatelcs added 5 commits June 24, 2026 17:17
Signed-off-by: bhavik.patel <bhavik.patel@uber.com>
Signed-off-by: bhavik.patel <bhavik.patel@uber.com>
Signed-off-by: bhavik.patel <bhavik.patel@uber.com>
Signed-off-by: bhavik.patel <bhavik.patel@uber.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

discuss Issues intended to help drive brainstorming and decision making enhancement Enhancement or improvement to existing feature or request RFC Issues requesting major changes Search:Resiliency

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Adaptive Coordinator-Level Concurrency Limiting for Scatter-Gather Workloads

1 participant