mochengqian commented on code in PR #928:
URL: https://github.com/apache/dubbo-go-pixiu/pull/928#discussion_r3294049944


##########
pkg/cluster/loadbalancer/maglev/permutation.go:
##########
@@ -187,10 +186,7 @@ func (t *LookUpTable) removePerm(dst int) {
 
 // Hash the input key.
 func (t *LookUpTable) Hash(key string) uint32 {
-       var h maphash.Hash
-       h.SetSeed(maphash.MakeSeed())
-       h.WriteString(key)
-       return uint32(h.Sum64())
+       return _hash1(key)
 }

Review Comment:
   Good catch. I updated the fix in e125a6db so `Hash()` no longer uses 
SHA3-512 on the request path. It now uses a dedicated deterministic request-key 
hash based on `xxhash.Sum64String`, while keeping `_hash1/_hash2` for Maglev 
table generation to avoid unnecessary endpoint-to-slot churn.
   
   I also added benchmarks for the old random `maphash`, SHA3-512, and xxHash 
request hashing. On my local darwin/arm64 run, SHA3-512 is ~148.9 ns/op with 1 
allocation, while xxHash is ~4.477 ns/op with 0 allocations. 
`BenchmarkLookUpTableGet` is ~10.12 ns/op with 0 allocations.



-- 
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]

Reply via email to