Skip to content

Commit 63c80fc

Browse files
committed
tests: avoid use of loopback dialer in Benchmark{Parallel,}Sysbench
When follow-the-workload is disabled (#153865), leases no longer reliably stay on n1. Since the workload clients are always created on n1, they were able to use the loopback dialer (which avoids going through the TCP layer by using inter-progress communication instead) prior to that change. We want these benchmarks to be independent of lease placement, so we disable the loopback dialer. That this was not done initially is likely an oversight. This commit will cause a a benchmark regression, but it is due to changing what is being benchmarked. The regression does not result in any production change.
1 parent 52aaf2e commit 63c80fc

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

pkg/sql/tests/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ go_test(
8989
"//pkg/kv/kvserver/concurrency",
9090
"//pkg/multitenant/tenantcapabilitiespb",
9191
"//pkg/roachpb",
92+
"//pkg/rpc",
9293
"//pkg/rpc/nodedialer",
9394
"//pkg/security/securityassets",
9495
"//pkg/security/securitytest",

pkg/sql/tests/sysbench_test.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ import (
2727
"github.com/cockroachdb/cockroach/pkg/kv"
2828
"github.com/cockroachdb/cockroach/pkg/kv/kvpb"
2929
"github.com/cockroachdb/cockroach/pkg/roachpb"
30+
"github.com/cockroachdb/cockroach/pkg/rpc"
3031
"github.com/cockroachdb/cockroach/pkg/rpc/nodedialer"
32+
"github.com/cockroachdb/cockroach/pkg/server"
3133
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
3234
"github.com/cockroachdb/cockroach/pkg/sql"
3335
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
@@ -164,25 +166,27 @@ func newTestCluster(
164166
// also moderately less realistic.
165167
disableBackgroundWork(st)
166168
const cacheSize = 2 * 1024 * 1024 * 1024 // 2GB
169+
knobs := base.TestingKnobs{
170+
DialerKnobs: nodedialer.DialerTestingKnobs{
171+
TestingNoLocalClientOptimization: !localRPCFastPath,
172+
},
173+
Server: &server.TestingKnobs{
174+
ContextTestingKnobs: rpc.ContextTestingKnobs{
175+
NoLoopbackDialer: !localRPCFastPath,
176+
},
177+
},
178+
}
167179
return serverutils.StartCluster(b, nodes, base.TestClusterArgs{
168180
ServerArgs: base.TestServerArgs{
169181
Settings: st,
170182
CacheSize: cacheSize,
171-
Knobs: base.TestingKnobs{
172-
DialerKnobs: nodedialer.DialerTestingKnobs{
173-
TestingNoLocalClientOptimization: !localRPCFastPath,
174-
},
175-
},
183+
Knobs: knobs,
176184
}},
177185
)
178186
}
179187

180188
// sysbenchSQL is SQL-based implementation of sysbenchDriver. It runs SQL
181189
// statements against a single node cluster.
182-
//
183-
// TODO(nvanbenschoten): add a 3-node cluster variant of this driver.
184-
// TODO(nvanbenschoten): add a variant of this driver which bypasses the gRPC
185-
// local fast-path optimization.
186190
type sysbenchSQL struct {
187191
ctx context.Context
188192
stopper *stop.Stopper
@@ -376,10 +380,6 @@ func (s *sysbenchSQLClient) prepConn() {
376380
// sysbenchKV is KV-based implementation of sysbenchDriver. It bypasses the SQL
377381
// layer and runs the workload directly against the KV layer, on a single node
378382
// cluster.
379-
//
380-
// TODO(nvanbenschoten): add a 3-node cluster variant of this driver.
381-
// TODO(nvanbenschoten): add a variant of this driver which bypasses the gRPC
382-
// local fast-path optimization.
383383
type sysbenchKV struct {
384384
ctx context.Context
385385
db *kv.DB

0 commit comments

Comments
 (0)