mochengqian opened a new pull request, #915:
URL: https://github.com/apache/dubbo-go-pixiu/pull/915
**What this PR does**:
This PR delivers **Step 1 (tests + benchmarks)** and **Step 2
(correctness)** for Issue #905, and is intended to be the first mergeable slice
with a clean boundary.
It:
- fixes `Rand` to choose only from the healthy endpoint slice and return
`nil` when no healthy endpoint exists
- fixes `RoundRobin` to return `nil` when no healthy endpoint exists
- makes the round-robin cursor safe for concurrent picks
- adds deterministic regression coverage for the current `Rand` /
`RoundRobin` correctness issues
- extends manager-path regression coverage for missing-cluster /
unhealthy-endpoint nil behavior
- adds and refines the benchmark suite, including:
- `PickEndpoint` serial baseline
- cleaner `PickEndpoint` parallel baseline
- lookup-only benchmark
- simple LB hot-path-only benchmark
- healthy endpoint filtering cost
- mixed `CompareAndSetStore` workload
- consistent-hash resolve baseline
This PR does **not** start the Step 3+ runtime-consistency / snapshot
refactor yet.
**Which issue(s) this PR fixes**:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
_If PR is about `failing-tests or flakes`, please post the related
issues/tests in a comment and do not use `Fixes`_*
-->
Fixes #905
**Special notes for your reviewer**:
Issue #905 step progress:
- [x] Add tests and benchmarks
- [x] Fix current correctness issues
- [ ] Tighten runtime consistency
- [ ] Switch cluster lookup to O(1)
- [ ] Introduce healthy endpoint snapshots
- [ ] Optimize simple LB hot path
- [ ] Optimize consistent-hash LB last
- This PR intentionally covers **Step 1 (tests + benchmarks)** and **Step 2
(correctness)** only.
- Runtime consistency for `UpdateCluster` / `CompareAndSetStore`, O(1)
cluster lookup, healthy endpoint snapshots, simple LB hot-path optimization,
and consistent-hash optimization will follow in later PRs.
- Detailed benchmark baseline numbers are posted in a separate PR comment so
later steps can compare against the same baseline.
- Local validation completed:
- `go test ./pkg/model ./pkg/server ./pkg/cluster/loadbalancer/rand
./pkg/cluster/loadbalancer/roundrobin -count=1`
- `go test ./pkg/server ./pkg/cluster/loadbalancer/rand
./pkg/cluster/loadbalancer/roundrobin -race -gcflags=-l -count=1`
- `go vet ./pkg/server ./pkg/cluster/loadbalancer/... ./pkg/model`
- `go test ./pkg/server -run '^$' -bench '^BenchmarkCluster' -benchmem
-count=5`
**Does this PR introduce a user-facing change?**:
<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires
additional action from users switching to the new release, include the string
"action required".
-->
```release-note
NONE
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]