Skip to content

Commit 0704f22

Browse files
committed
feat(benchmarks/rps): Add unix support.
1 parent 12c5f16 commit 0704f22

File tree

6 files changed

+49
-59
lines changed

6 files changed

+49
-59
lines changed

benchmarks/rps/cmd/orb-rps-client/config.go

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ import (
99
const (
1010
configSection = "benchClient"
1111

12-
defaultBypassRegistry = 1
13-
defaultConnections = 256
14-
defaultPoolSize = 256
15-
defaultDuration = 15
16-
defaultTimeout = 15
17-
defaultTransport = "grpc"
18-
defaultPackageSize = 1000
19-
defaultContentType = "application/x-protobuf"
12+
defaultConnections = 256
13+
defaultPoolSize = 256
14+
defaultDuration = 15
15+
defaultTimeout = 15
16+
defaultTransport = "grpc"
17+
defaultPackageSize = 1000
18+
defaultContentType = "application/x-protobuf"
2019
)
2120

2221
//nolint:gochecknoglobals
@@ -27,14 +26,6 @@ var (
2726
func flags() []*cli.Flag {
2827
var flags []*cli.Flag
2928

30-
flags = append(flags, cli.NewFlag(
31-
"bypass_registry",
32-
defaultBypassRegistry,
33-
cli.FlagConfigPaths([]string{configSection, "bypassRegistry"}),
34-
cli.FlagUsage("Bypasses the registry by caching it, set to 0 to disable"),
35-
cli.FlagEnvVars("BYPASS_REGISTRY"),
36-
))
37-
3829
flags = append(flags, cli.NewFlag(
3930
"pool_size",
4031
defaultPoolSize,
@@ -103,13 +94,12 @@ func flags() []*cli.Flag {
10394
}
10495

10596
type clientConfig struct {
106-
BypassRegistry int `json:"bypassRegistry" yaml:"bypassRegistry"`
107-
PoolSize int `json:"poolSize" yaml:"poolSize"`
108-
Connections int `json:"connections" yaml:"connections"`
109-
Duration int `json:"duration" yaml:"duration"`
110-
Timeout int `json:"timeout" yaml:"timeout"`
111-
Threads int `json:"threads" yaml:"threads"`
112-
Transport string `json:"transport" yaml:"transport"`
113-
PackageSize int `json:"packageSize" yaml:"packageSize"`
114-
ContentType string `json:"contentType" yaml:"contentType"`
97+
PoolSize int `json:"poolSize" yaml:"poolSize"`
98+
Connections int `json:"connections" yaml:"connections"`
99+
Duration int `json:"duration" yaml:"duration"`
100+
Timeout int `json:"timeout" yaml:"timeout"`
101+
Threads int `json:"threads" yaml:"threads"`
102+
Transport string `json:"transport" yaml:"transport"`
103+
PackageSize int `json:"packageSize" yaml:"packageSize"`
104+
ContentType string `json:"contentType" yaml:"contentType"`
115105
}

benchmarks/rps/cmd/orb-rps-client/main.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,21 +101,6 @@ func setupClientOptions(ctx context.Context, cfg *clientConfig, cli client.Type,
101101
client.WithContentType(cfg.ContentType),
102102
}
103103

104-
// Handle direct connection (bypass registry)
105-
if cfg.BypassRegistry == 1 {
106-
logger.Debug("Resolving service", "server", serverName)
107-
108-
// Resolve service nodes
109-
address, _, err := cli.SelectService(ctx, serverName, client.WithPreferredTransports(cfg.Transport))
110-
if err != nil {
111-
return nil, fmt.Errorf("failed to resolve service: %w", err)
112-
}
113-
114-
// Add direct URL to options
115-
opts = append(opts, client.WithURL(fmt.Sprintf("%s://%s", cfg.Transport, address)))
116-
logger.Info("Using transport", "transport", cfg.Transport)
117-
}
118-
119104
return opts, nil
120105
}
121106

@@ -157,7 +142,6 @@ func runBenchmark(
157142
func bench(ctx context.Context, cfg *clientConfig, logger log.Logger, cli client.Type) error {
158143
// Log configuration
159144
logger.Info("Configuration",
160-
"bypass_registry", cfg.BypassRegistry,
161145
"connections", cfg.Connections,
162146
"duration", cfg.Duration,
163147
"timeout", cfg.Timeout,

benchmarks/rps/cmd/orb-rps-client/wire.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,14 @@ func wireRun(
7070

7171
func provideClientConfig(svcCtx *cli.ServiceContextWithConfig) (*clientConfig, error) {
7272
cfg := &clientConfig{
73-
BypassRegistry: defaultBypassRegistry,
74-
PoolSize: defaultPoolSize,
75-
Connections: defaultConnections,
76-
Duration: defaultDuration,
77-
Timeout: defaultTimeout,
78-
Threads: defaultThreads,
79-
Transport: defaultTransport,
80-
PackageSize: defaultPackageSize,
81-
ContentType: defaultContentType,
73+
PoolSize: defaultPoolSize,
74+
Connections: defaultConnections,
75+
Duration: defaultDuration,
76+
Timeout: defaultTimeout,
77+
Threads: defaultThreads,
78+
Transport: defaultTransport,
79+
PackageSize: defaultPackageSize,
80+
ContentType: defaultContentType,
8281
}
8382

8483
if err := config.Parse(nil, configSection, svcCtx.Config(), &cfg); err != nil && !errors.Is(err, config.ErrNoSuchKey) {

benchmarks/rps/cmd/orb-rps-client/wire_gen.go

Lines changed: 8 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benchmarks/rps/cmd/orb-rps-server/wire.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ func provideServerOpts() ([]server.ConfigOption, error) {
6565
opts = append(opts, server.WithEntrypointConfig("drpc", drpc.NewConfig(
6666
drpc.WithHandlers(hRegister),
6767
)))
68+
opts = append(opts, server.WithEntrypointConfig("unix+drpc", drpc.NewConfig(
69+
drpc.WithNetwork("unix"),
70+
drpc.WithAddress("/tmp/orb-rps-server-drpc.sock"),
71+
drpc.WithHandlers(hRegister),
72+
)))
73+
opts = append(opts, server.WithEntrypointConfig("unix+grpc", mgrpc.NewConfig(
74+
mgrpc.WithNetwork("unix"),
75+
mgrpc.WithAddress("/tmp/orb-rps-server-grpc.sock"),
76+
mgrpc.WithHandlers(hRegister),
77+
)))
78+
opts = append(opts, server.WithEntrypointConfig("unix+http", mhttp.NewConfig(
79+
mhttp.WithNetwork("unix"),
80+
mhttp.WithAddress("/tmp/orb-rps-server-http.sock"),
81+
mhttp.WithHandlers(hRegister),
82+
)))
6883

6984
return opts, nil
7085
}

benchmarks/rps/cmd/orb-rps-server/wire_gen.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)