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
2026-01-19 19:26:30 +00:00
parent 04dc0fda60
commit 3e1246984c
5 changed files with 16 additions and 6 deletions

View File

@@ -18,6 +18,7 @@ ARG RUST_BACKTRACE
ARG JEMALLOC_OVERRIDE ARG JEMALLOC_OVERRIDE
ARG ROCKSDB_LIB_DIR ARG ROCKSDB_LIB_DIR
ARG VALGRINDFLAGS="" ARG VALGRINDFLAGS=""
ARG VALGRIND_MAX_WORKERS=128
ARG CARGO_BUILD_RUSTFLAGS ARG CARGO_BUILD_RUSTFLAGS
ARG CARGO_PROFILE_TEST_DEBUG ARG CARGO_PROFILE_TEST_DEBUG
ARG CARGO_PROFILE_TEST_INCREMENTAL ARG CARGO_PROFILE_TEST_INCREMENTAL
@@ -53,6 +54,7 @@ ENV RUST_BACKTRACE="${RUST_BACKTRACE}"
ENV JEMALLOC_OVERRIDE="${JEMALLOC_OVERRIDE}" ENV JEMALLOC_OVERRIDE="${JEMALLOC_OVERRIDE}"
ENV ROCKSDB_LIB_DIR="${ROCKSDB_LIB_DIR}" ENV ROCKSDB_LIB_DIR="${ROCKSDB_LIB_DIR}"
ENV VALGRINDFLAGS="${VALGRINDFLAGS}" 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_DEBUG="${CARGO_PROFILE_TEST_DEBUG}"
ENV CARGO_PROFILE_TEST_INCREMENTAL="${CARGO_PROFILE_TEST_INCREMENTAL}" ENV CARGO_PROFILE_TEST_INCREMENTAL="${CARGO_PROFILE_TEST_INCREMENTAL}"
ENV CARGO_PROFILE_BENCH_DEBUG="${CARGO_PROFILE_BENCH_DEBUG}" ENV CARGO_PROFILE_BENCH_DEBUG="${CARGO_PROFILE_BENCH_DEBUG}"

View File

@@ -450,10 +450,18 @@ group "integration" {
] ]
} }
variable "valgrind_max_workers" {
default = 128
}
variable "valgrind_flags" { variable "valgrind_flags" {
default = "--error-exitcode=1 --exit-on-first-error=yes --undef-value-errors=no --leak-check=no" 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" { target "rust-sdk-valgrind" {
name = elem("rust-sdk-valgrind", [cargo_profile, rust_toolchain, rust_target, feat_set, sys_name, sys_version, sys_target]) name = elem("rust-sdk-valgrind", [cargo_profile, rust_toolchain, rust_target, feat_set, sys_name, sys_version, sys_target])
tags = [ tags = [
@@ -469,7 +477,7 @@ target "rust-sdk-valgrind" {
} }
args = { args = {
VALGRINDFLAGS = "${valgrind_flags}" 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_test_args = ""
mrsdk_startup_delay = "30s" mrsdk_startup_delay = "30s"
mrsdk_skip_list =<<EOF 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]) input = elem("target:build-tests", [cargo_profile, rust_toolchain, rust_target, feat_set, sys_name, sys_version, sys_target])
} }
args = { args = {
VALGRIND_MAX_WORKERS = "${valgrind_max_workers}"
VALGRINDFLAGS = "${valgrind_flags}" VALGRINDFLAGS = "${valgrind_flags}"
cargo_cmd = "valgrind test" cargo_cmd = "valgrind test"
cargo_args = "--test=*" cargo_args = "--test=*"

View File

@@ -1987,8 +1987,7 @@ pub struct Config {
/// Sets the number of worker threads in the frontend-pool of the database. /// Sets the number of worker threads in the frontend-pool of the database.
/// This number should reflect the I/O capabilities of the system, /// This number should reflect the I/O capabilities of the system,
/// such as the queue-depth or the number of simultaneous requests in /// 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 /// flight. Defaults to 32 times the number of CPU cores.
/// is greater.
/// ///
/// Note: This value is only used if db_pool_affinity is disabled or not /// Note: This value is only used if db_pool_affinity is disabled or not
/// detected on the system, otherwise it is determined automatically. /// detected on the system, otherwise it is determined automatically.

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. // The default worker count is masked-on if we didn't find better information.
let default_worker_count = topology_detected let default_worker_count = topology_detected
.is_false() .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 // 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 // default to the default_worker_count. Note well that the thread-worker model

View File

@@ -1712,8 +1712,7 @@
# Sets the number of worker threads in the frontend-pool of the database. # Sets the number of worker threads in the frontend-pool of the database.
# This number should reflect the I/O capabilities of the system, # This number should reflect the I/O capabilities of the system,
# such as the queue-depth or the number of simultaneous requests in # 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 # flight. Defaults to 32 times the number of CPU cores.
# is greater.
# #
# Note: This value is only used if db_pool_affinity is disabled or not # Note: This value is only used if db_pool_affinity is disabled or not
# detected on the system, otherwise it is determined automatically. # detected on the system, otherwise it is determined automatically.