enhance: reduce quota and SetRates allocations - #22
Merged
sunby merged 1 commit intoSep 9, 2026
Merged
Conversation
Signed-off-by: sunby <sunbingyi1992@gmail.com>
sunby
merged commit Sep 9, 2026
b18065d
into
codex/load-1m-segments-pr-stack-rebased-qv-work
10 of 13 checks passed
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
Reduce temporary allocation in the periodic quota calculation and SetRates fan-out, while keeping full SetRates snapshots and the existing quota-control data.
No new configuration or protocol fields. No WAL, inspector, deployment or image changes.
GetQuotaInfostill scans the segment cache, andGetAllCollectionNumRowsstill has its separate scan; incremental metadata statistics and delta SetRates are outside this PR.Base and reference
sunby/milvus:codex/load-1m-segments-pr-stack-rebased-qv-workatea49a320ef8f2fcc30c7cea8fd14881e3b0f63f7.Verification
Rerun on the submission base with
-tags dynamic,test -gcflags="all=-N -l" -count=1, an isolated localhost etcd and the existing local native library build:RootCoord QuotaCenter/QuotaCenterSuite, reset, disk-quota and request-limiter selections plus the new quota tests passed (24.719 s); DataCoord quota aggregation selections passed (1.611 s).
Complete distributed Proxy client, ProxyClientManager and rate-limiter-tree package tests passed.
New lifecycle/projection/denial-recovery, aggregate-control-data and concurrent SetRates codec/retry tests passed with
-raceacross RootCoord, DataCoord and the distributed Proxy client.Changed-code golangci-lint against the submission base passed for all four changed packages:
0 issues. New test files are included in the committed diff used for filtering.git diff --checkpassed.make lint-fixran gofumpt/gci and full root-module lint, then failed atinternal/metastore/kv/querycoord/kv_catalog_test.go:372:15: undefined: mocks. That file has the identical blob in base and head; pkg/client lint stages were not reached. This unrelated baseline issue is not fixed here.internal/core/run_clang_format.sh internal/corecompleted using clang-format 15.0.7. Formatter-only changes were reverted; the PR contains no C/C++ or unrelated formatting changes.Behavioral coverage includes differential comparison with the old fresh-tree calculation; rate/property/config changes; deletion and recreation; clearing prior denial states; and Coordinator snapshot -> protobuf -> real Proxy limiter denial/recovery at cluster, database, collection and partition scope. Tests also cover Proxy-count changes, concurrent encoding with retries, independent routing headers and unknown fields, and aggregate/full metric mode changes without altering quota-control data.
The ownership audit traced quota-loop publication, synchronous Proxy fan-out, client retries, the registered gRPC codec and Proxy limiter consumption. The shared payload remains read-only, and later quota calculations do not mutate published snapshots.
Local microbenchmarks
100,000 collections, Apple M5, darwin/arm64, Go 1.26.5;
-tags dynamic,test -gcflags="all=-N -l" -benchtime=3x -benchmem:The reset benchmark uses stable membership, no collection properties and disabled partition limits; both paths use the optimized property reader, excluding that reader's savings. The copy benchmark excludes serialization, network and Proxy processing. DataCoord uses one segment per collection in one database, with the identical fixture run against the unchanged baseline. These earlier function-level measurements are not production CPU, GC or search-latency results.
Remaining validation
Full
make test-goand production-build end-to-end acceptance were not run. Actual Proxy process restart/network membership churn and same-load MixCoord CPU/alloc/latency A/B remain to be validated. Full scans and protobuf serialization remain; this PR does not claim to eliminate the CPU sawtooth.