[feature](fe) Add meta service RPC rate limit dry-run mode - #66940
[feature](fe) Add meta service RPC rate limit dry-run mode#66940mymeiyi wants to merge 1 commit into
Conversation
### What problem does this PR solve? Issue Number: None Related PR: None Problem Summary: Enabling FE-side meta service RPC rate limiting immediately waits for or rejects requests, so operators cannot evaluate whether the configured limits fit production traffic first. Add a dry-run mode that evaluates the shared rate limiter and reports would-wait and would-reject decisions without delaying or rejecting RPCs. Enable rate limit evaluation and dry-run mode by default so deployments collect observations before enforcement. ### Release note Add meta_service_rpc_rate_limit_dry_run and enable FE meta service RPC rate limit dry-run evaluation by default. ### Check List (For Author) - Test: Unit tests added but not run, as requested - Behavior changed: Yes, rate limit evaluation and dry-run reporting are enabled by default without enforcing limits - Does this need documentation: No
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
/review |
There was a problem hiding this comment.
Pull request overview
Adds a “dry-run” mode to the FE meta service RPC rate limiter so operators can observe would-wait / would-reject outcomes (via logs/metrics) without actually delaying or rejecting RPC traffic. This fits into Doris FE cloud-mode meta service client behavior and its operational observability (CloudMetrics).
Changes:
- Introduces
meta_service_rpc_rate_limit_dry_runand uses it inMetaServiceRpcRateLimiter.acquire()to bypass waiting/rejecting while still reporting outcomes. - Adds new CloudMetrics for dry-run would-reject counts and would-wait latency histograms.
- Extends existing FE tests to cover dry-run behavior and ensures test helpers explicitly disable dry-run when needed.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
fe/fe-core/src/main/java/org/apache/doris/cloud/rpc/MetaServiceRpcRateLimiter.java |
Adds dry-run branches for would-reject / would-wait reporting without enforcement. |
fe/fe-core/src/main/java/org/apache/doris/metric/CloudMetrics.java |
Registers new per-method + aggregate counters and per-method histogram for dry-run rate-limit observations. |
fe/fe-common/src/main/java/org/apache/doris/common/Config.java |
Adds the new dry-run config flag and adjusts rate-limit-related defaults. |
fe/fe-core/src/test/java/org/apache/doris/cloud/rpc/MetaServiceRpcRateLimiterTest.java |
Adds tests validating dry-run does not reject or wait. |
fe/fe-core/src/test/java/org/apache/doris/cloud/rpc/MetaServiceProxyTest.java |
Ensures tests save/restore the new dry-run config and keep rate limiting disabled by default within tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| @ConfField(mutable = true, description = "Whether to only evaluate and report meta service RPC rate limits " | ||
| + "without waiting or rejecting requests. This takes effect only when meta service RPC rate limiting " | ||
| + "is enabled.") | ||
| public static boolean meta_service_rpc_rate_limit_dry_run = true; |
|
|
||
| @ConfField(mutable = true, description = "Whether to enable QPS rate limit for RPC requests to meta service.") | ||
| public static boolean meta_service_rpc_rate_limit_enabled = false; | ||
| public static boolean meta_service_rpc_rate_limit_enabled = true; |
|
Codex automated review failed and did not complete. Error: Review context preparation failed before Codex ran; inspect the 'Prepare authoritative PR context and required AGENTS guides' step. Please inspect the workflow logs and rerun the review after the underlying issue is resolved. |
| boolean dryRun = Config.meta_service_rpc_rate_limit_dry_run; | ||
| if (nanosToWait < 0) { | ||
| if (dryRun) { | ||
| if (MetricRepo.isInit && Config.isCloudMode()) { |
There was a problem hiding this comment.
why should we check Config.isCloudMode() in a cloud context object MetaServiceRpcRateLimiter?
the cloud check is redundant?
| CloudMetrics.META_SERVICE_RPC_ALL_RATE_LIMIT_DRY_RUN_REJECTED.increase(1L); | ||
| CloudMetrics.META_SERVICE_RPC_RATE_LIMIT_DRY_RUN_REJECTED.getOrAdd(methodName).increase(1L); | ||
| } | ||
| LOG.debug("meta service rpc rate limiter dry run would reject request, method: {}, permits: {}, " |
There was a problem hiding this comment.
better check if (debug enabled) first, because it may be a hot path.
| CloudMetrics.META_SERVICE_RPC_ALL_RATE_LIMIT_DRY_RUN_REJECTED.increase(1L); | ||
| CloudMetrics.META_SERVICE_RPC_RATE_LIMIT_DRY_RUN_REJECTED.getOrAdd(methodName).increase(1L); |
There was a problem hiding this comment.
the metrics should always be recorded if it is throttled
the meta_service_rpc_rate_limit_dry_run is used to return 0 instead of throw error only.
|
|
||
| long waitMs = TimeUnit.NANOSECONDS.toMillis(nanosToWait); | ||
| if (dryRun) { | ||
| if (MetricRepo.isInit && Config.isCloudMode()) { |
| public static AutoMappedMetric<LongCounterMetric> META_SERVICE_RPC_TOTAL; | ||
| public static AutoMappedMetric<LongCounterMetric> META_SERVICE_RPC_FAILED; | ||
| public static AutoMappedMetric<LongCounterMetric> META_SERVICE_RPC_RATE_LIMITED; | ||
| public static AutoMappedMetric<LongCounterMetric> META_SERVICE_RPC_RATE_LIMIT_DRY_RUN_REJECTED; |
There was a problem hiding this comment.
the name should not contains dryrun, because when we are not running in dry run mode, the throttled metrics should be recorded too.
There was a problem hiding this comment.
if there are metrics record throttled request, reuse them, so there are no more new metrics should be added
Enabling FE-side meta service RPC rate limiting immediately waits for or rejects requests, so operators cannot evaluate whether the configured limits fit production traffic first.
Add a dry-run mode that evaluates the shared rate limiter and reports would-wait and would-reject decisions without delaying or rejecting RPCs.