MCPcopy
hub / github.com/redis/go-redis / BenchmarkRingShardingRebalanceLocked

Function BenchmarkRingShardingRebalanceLocked

internal_test.go:535–552  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

533}
534
535func BenchmarkRingShardingRebalanceLocked(b *testing.B) {
536 opts := &RingOptions{
537 Addrs: make(map[string]string),
538 // Disable heartbeat
539 HeartbeatFrequency: 1 * time.Hour,
540 }
541 for i := 0; i < 100; i++ {
542 opts.Addrs[fmt.Sprintf("shard%d", i)] = fmt.Sprintf(":63%02d", i)
543 }
544
545 ring := NewRing(opts)
546 defer ring.Close()
547
548 b.ResetTimer()
549 for i := 0; i < b.N; i++ {
550 ring.sharding.rebalanceLocked()
551 }
552}
553
554type testCounter struct {
555 mu sync.Mutex

Callers

nothing calls this directly

Calls 3

CloseMethod · 0.95
NewRingFunction · 0.85
rebalanceLockedMethod · 0.80

Tested by

no test coverage detected