Repository navigation
bench(daemon): thread-per-connection scaling at 100/1k/10k connections (#1933) - #4182
Merged
Merged
Conversation
oferchen
force-pushed
the
bench/daemon-thread-per-connection-1933
branch
4 times, most recently
from
May 16, 2026 22:08
9ab3c74 to
6db0546
Compare
Adds an integration-test-shaped stress benchmark that drives 100, 1000, and 10000 concurrent TCP clients against the daemon listener, capturing wall time, ECONNREFUSED / EMFILE counts, and peak RSS via getrusage. All three scenarios are marked #[ignore]; the 10k case is unix-only and self-skips when RLIMIT_NOFILE cannot accommodate the request. The harness exists to provide evidence for whether an async listener (tracked separately) would be a meaningful change to the current std::thread::spawn-per-connection model.
The conversion was redundant on all targets we build on: c_long is i64 on 64-bit Linux/macOS (no conversion needed) and i32 on 32-bit Linux (the subsequent 'as u64' sign-extends to i64 first, then saturating_mul operates on u64). Removing the conversion silences both clippy::unnecessary_cast and clippy::useless_conversion without losing overflow safety.
oferchen
force-pushed
the
bench/daemon-thread-per-connection-1933
branch
from
May 16, 2026 22:34
6db0546 to
7c7fd9d
Compare
oferchen
added a commit
that referenced
this pull request
May 18, 2026
#1933) (#4182) * chore(bench): stress harness for thread-per-connection scaling Adds an integration-test-shaped stress benchmark that drives 100, 1000, and 10000 concurrent TCP clients against the daemon listener, capturing wall time, ECONNREFUSED / EMFILE counts, and peak RSS via getrusage. All three scenarios are marked #[ignore]; the 10k case is unix-only and self-skips when RLIMIT_NOFILE cannot accommodate the request. The harness exists to provide evidence for whether an async listener (tracked separately) would be a meaningful change to the current std::thread::spawn-per-connection model. * style(daemon): apply rustfmt to connection_scaling_stress * fix(daemon): convert ru_maxrss via i64::from for cross-arch portability * fix(daemon): use ru_maxrss directly without conversion The conversion was redundant on all targets we build on: c_long is i64 on 64-bit Linux/macOS (no conversion needed) and i32 on 32-bit Linux (the subsequent 'as u64' sign-extends to i64 first, then saturating_mul operates on u64). Removing the conversion silences both clippy::unnecessary_cast and clippy::useless_conversion without losing overflow safety.
oferchen
added a commit
that referenced
this pull request
May 18, 2026
#1933) (#4182) * chore(bench): stress harness for thread-per-connection scaling Adds an integration-test-shaped stress benchmark that drives 100, 1000, and 10000 concurrent TCP clients against the daemon listener, capturing wall time, ECONNREFUSED / EMFILE counts, and peak RSS via getrusage. All three scenarios are marked #[ignore]; the 10k case is unix-only and self-skips when RLIMIT_NOFILE cannot accommodate the request. The harness exists to provide evidence for whether an async listener (tracked separately) would be a meaningful change to the current std::thread::spawn-per-connection model. * style(daemon): apply rustfmt to connection_scaling_stress * fix(daemon): convert ru_maxrss via i64::from for cross-arch portability * fix(daemon): use ru_maxrss directly without conversion The conversion was redundant on all targets we build on: c_long is i64 on 64-bit Linux/macOS (no conversion needed) and i32 on 32-bit Linux (the subsequent 'as u64' sign-extends to i64 first, then saturating_mul operates on u64). Removing the conversion silences both clippy::unnecessary_cast and clippy::useless_conversion without losing overflow safety.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
#1933) (#4182) * chore(bench): stress harness for thread-per-connection scaling Adds an integration-test-shaped stress benchmark that drives 100, 1000, and 10000 concurrent TCP clients against the daemon listener, capturing wall time, ECONNREFUSED / EMFILE counts, and peak RSS via getrusage. All three scenarios are marked #[ignore]; the 10k case is unix-only and self-skips when RLIMIT_NOFILE cannot accommodate the request. The harness exists to provide evidence for whether an async listener (tracked separately) would be a meaningful change to the current std::thread::spawn-per-connection model. * style(daemon): apply rustfmt to connection_scaling_stress * fix(daemon): convert ru_maxrss via i64::from for cross-arch portability * fix(daemon): use ru_maxrss directly without conversion The conversion was redundant on all targets we build on: c_long is i64 on 64-bit Linux/macOS (no conversion needed) and i32 on 32-bit Linux (the subsequent 'as u64' sign-extends to i64 first, then saturating_mul operates on u64). Removing the conversion silences both clippy::unnecessary_cast and clippy::useless_conversion without losing overflow safety.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
crates/daemon/tests/connection_scaling_stress.rs, a stress harness that drives 100 / 1000 / 10000 concurrent TCP clients against the daemon'sstd::thread::spawn-per-connection listener.ECONNREFUSED/EMFILE/ generic failure counts, and peak RSS viagetrusage(RUSAGE_SELF).ru_maxrss.#[ignore]so the defaultnextestrun is unaffected. The 10000-connection case is#[cfg(unix)]and tries to raiseRLIMIT_NOFILEto the hard limit; when the hard limit is too low it self-skips with a logged message instead of failing.Why
Issue #1933 asks for quantitative evidence about whether the current thread-per-connection model is a bottleneck before committing to an async listener (tracked separately as #1935 / #1367). This harness produces the numbers needed for that decision without changing the daemon itself.
Running the harness
Each scenario prints a one-line report like:
Test plan