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

Function BenchmarkClusterSetString

bench_test.go:562–592  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

560}
561
562func BenchmarkClusterSetString(b *testing.B) {
563 if testing.Short() {
564 b.Skip("skipping in short mode")
565 }
566
567 ctx := context.Background()
568 if clusterBench == nil {
569 clusterBench = newClusterScenario()
570 if err := configureClusterTopology(ctx, clusterBench); err != nil {
571 b.Fatal(err)
572 }
573 }
574
575 client := clusterBench.newClusterClient(ctx, redisClusterOptions())
576 defer client.Close()
577
578 value := string(bytes.Repeat([]byte{'1'}, 10000))
579
580 b.Run("cluster set string", func(b *testing.B) {
581 b.ResetTimer()
582
583 b.RunParallel(func(pb *testing.PB) {
584 for pb.Next() {
585 err := client.Set(ctx, "key", value, 0).Err()
586 if err != nil {
587 b.Fatal(err)
588 }
589 }
590 })
591 })
592}
593
594func BenchmarkExecRingSetAddrsCmd(b *testing.B) {
595 const (

Callers

nothing calls this directly

Calls 9

newClusterScenarioFunction · 0.85
configureClusterTopologyFunction · 0.85
redisClusterOptionsFunction · 0.85
newClusterClientMethod · 0.80
CloseMethod · 0.65
NextMethod · 0.65
ErrMethod · 0.65
SetMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected