Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/config/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ struct Config {
std::optional<AdminConfig> admin;
std::string relayID; // always set: from config or randomly generated
uint32_t threads{1};
bool useRelayThread{true};
bool mvfstBpfSteering{true};
};

Expand Down
8 changes: 6 additions & 2 deletions src/config/ConfigResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,8 +822,11 @@ folly::Expected<ResolvedConfig, std::string> resolveConfig(const ParsedConfig& c
const uint32_t threads = config.threads.value().value_or(1);
if (threads == 0) {
errors.push_back("threads must be >= 1");
} else if (threads > 1) {
errors.push_back("threads > 1 is not yet supported");
}

const bool useRelayThread = config.use_relay_thread.value().value_or(true);
if (threads > 1 && !useRelayThread) {
errors.push_back("use_relay_thread must be true when threads > 1");
}

const bool mvfstBpfSteering = config.mvfst_bpf_steering.value().value_or(true);
Expand Down Expand Up @@ -877,6 +880,7 @@ folly::Expected<ResolvedConfig, std::string> resolveConfig(const ParsedConfig& c
.admin = std::move(adminConfig),
.relayID = std::move(relayID),
.threads = threads,
.useRelayThread = useRelayThread,
.mvfstBpfSteering = mvfstBpfSteering,
},
.warnings = std::move(warnings),
Expand Down
5 changes: 5 additions & 0 deletions src/config/loader/ParsedConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,11 @@ struct ParsedConfig {
std::optional<ParsedListenerDefaultsConfig>>
listener_defaults;
rfl::Description<"Number of IO worker threads (default: 1)", std::optional<uint32_t>> threads;
rfl::Description<
"Dedicate one relay thread per service for relay state isolation (default: true). "
"Disable for baseline performance comparison.",
std::optional<bool>>
use_relay_thread;
rfl::Description<
"Attach a classic BPF reuseport filter to steer QUIC packets to the correct mvfst worker "
"based on the connection ID's workerId field (Linux only, mvfst stack only, default: true). "
Expand Down
21 changes: 19 additions & 2 deletions test/config/ConfigResolverTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,12 +920,29 @@ TEST(ResolveConfig, ThreadsZeroRejected) {
EXPECT_THAT(result.error(), HasSubstr("threads must be >= 1"));
}

TEST(ResolveConfig, ThreadsGreaterThanOneRejected) {
TEST(ResolveConfig, ThreadsGreaterThanOneAccepted) {
auto cfg = makeMinimalInsecureConfig();
cfg.threads = std::optional<uint32_t>{2};
auto result = resolveConfig(cfg);
ASSERT_TRUE(result.hasValue());
EXPECT_EQ(result.value().config.threads, 2u);
}

TEST(ResolveConfig, UseRelayThreadFalseWithOneThreadAccepted) {
auto cfg = makeMinimalInsecureConfig();
cfg.use_relay_thread = std::optional<bool>{false};
auto result = resolveConfig(cfg);
ASSERT_TRUE(result.hasValue());
EXPECT_FALSE(result.value().config.useRelayThread);
}

TEST(ResolveConfig, UseRelayThreadFalseWithMultipleThreadsRejected) {
auto cfg = makeMinimalInsecureConfig();
cfg.threads = std::optional<uint32_t>{2};
cfg.use_relay_thread = std::optional<bool>{false};
auto result = resolveConfig(cfg);
ASSERT_TRUE(result.hasError());
EXPECT_THAT(result.error(), HasSubstr("threads > 1 is not yet supported"));
EXPECT_THAT(result.error(), HasSubstr("use_relay_thread must be true when threads > 1"));
}

// --- multiple listeners tests ---
Expand Down
Loading