Adjust pool defaults for many core systems with undetected topologies.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk committed 2026-01-20 00:18:00 +00:00
1 parent 04dc0fda60
commit 3e1246984c
5 files changed
+16 -6

No files matched your search

+2
View File
@@ -18,6 +18,7 @@ ARG RUST_BACKTRACE
ARG JEMALLOC_OVERRIDE
ARG ROCKSDB_LIB_DIR
ARG VALGRINDFLAGS=""
ARG VALGRIND_MAX_WORKERS=128
ARG CARGO_BUILD_RUSTFLAGS
ARG CARGO_PROFILE_TEST_DEBUG
ARG CARGO_PROFILE_TEST_INCREMENTAL
@@ -53,6 +54,7 @@ ENV RUST_BACKTRACE="${RUST_BACKTRACE}"
ENV JEMALLOC_OVERRIDE="${JEMALLOC_OVERRIDE}"
ENV ROCKSDB_LIB_DIR="${ROCKSDB_LIB_DIR}"
ENV VALGRINDFLAGS="${VALGRINDFLAGS}"
ENV TUWUNEL_DB_POOL_MAX_WORKERS="${VALGRIND_MAX_WORKERS}"
ENV CARGO_PROFILE_TEST_DEBUG="${CARGO_PROFILE_TEST_DEBUG}"
ENV CARGO_PROFILE_TEST_INCREMENTAL="${CARGO_PROFILE_TEST_INCREMENTAL}"
ENV CARGO_PROFILE_BENCH_DEBUG="${CARGO_PROFILE_BENCH_DEBUG}"
+10 -1
View File
@@ -450,10 +450,18 @@ group "integration" {
]
}
variable "valgrind_max_workers" {
default = 128
}
variable "valgrind_flags" {
default = "--error-exitcode=1 --exit-on-first-error=yes --undef-value-errors=no --leak-check=no"
}
variable "valgrind_testee_args" {
default = "-Odb_pool_max_workers=${valgrind_max_workers}"
}
target "rust-sdk-valgrind" {
name = elem("rust-sdk-valgrind", [cargo_profile, rust_toolchain, rust_target, feat_set, sys_name, sys_version, sys_target])
tags = [
@@ -469,7 +477,7 @@ target "rust-sdk-valgrind" {
}
args = {
VALGRINDFLAGS = "${valgrind_flags}"
mrsdk_testee = "valgrind ${valgrind_flags} /usr/bin/tuwunel"
mrsdk_testee = "valgrind ${valgrind_flags} /usr/bin/tuwunel ${valgrind_testee_args}"
mrsdk_test_args = ""
mrsdk_startup_delay = "30s"
mrsdk_skip_list =<<EOF
@@ -522,6 +530,7 @@ target "integ-valgrind" {
input = elem("target:build-tests", [cargo_profile, rust_toolchain, rust_target, feat_set, sys_name, sys_version, sys_target])
}
args = {
VALGRIND_MAX_WORKERS = "${valgrind_max_workers}"
VALGRINDFLAGS = "${valgrind_flags}"
cargo_cmd = "valgrind test"
cargo_args = "--test=*"
+1 -2
View File
@@ -1987,8 +1987,7 @@ pub struct Config {
/// Sets the number of worker threads in the frontend-pool of the database.
/// This number should reflect the I/O capabilities of the system,
/// such as the queue-depth or the number of simultaneous requests in
/// flight. Defaults to 32 or four times the number of CPU cores, whichever
/// is greater.
/// flight. Defaults to 32 times the number of CPU cores.
///
/// Note: This value is only used if db_pool_affinity is disabled or not
/// detected on the system, otherwise it is determined automatically.
+2 -1
View File
@@ -69,7 +69,8 @@ pub(super) fn configure(server: &Arc<Server>) -> (Vec<usize>, Vec<usize>, Vec<us
// The default worker count is masked-on if we didn't find better information.
let default_worker_count = topology_detected
.is_false()
.then_some(config.db_pool_workers);
.then_some(config.db_pool_workers)
.map(|workers| workers.saturating_mul(num_cores));
// Sum the total number of possible tags. When no hardware detected this will
// default to the default_worker_count. Note well that the thread-worker model
+1 -2
View File
@@ -1712,8 +1712,7 @@
# Sets the number of worker threads in the frontend-pool of the database.
# This number should reflect the I/O capabilities of the system,
# such as the queue-depth or the number of simultaneous requests in
# flight. Defaults to 32 or four times the number of CPU cores, whichever
# is greater.
# flight. Defaults to 32 times the number of CPU cores.
#
# Note: This value is only used if db_pool_affinity is disabled or not
# detected on the system, otherwise it is determined automatically.