-
Notifications
You must be signed in to change notification settings - Fork 621
fix: use single-threaded tokio runtime in sccache client #2460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: use single-threaded tokio runtime in sccache client #2460
Conversation
|
could you please add a test to make sure we don't regress in the future on this? thanks |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2460 +/- ##
==========================================
- Coverage 71.05% 71.04% -0.01%
==========================================
Files 64 64
Lines 35359 35369 +10
==========================================
+ Hits 25124 25129 +5
- Misses 10235 10240 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The sccache client was using Runtime::new() which creates a multi-threaded tokio runtime with worker threads equal to the number of CPU cores. On high-core-count servers running many parallel builds, this created an excessive number of threads. For example: - 96 vCPU server - 10 concurrent make invocations - Each make using -j16 - Result: 96 × 10 × 16 = 15,360 threads created by sccache wrappers While these threads are short-lived, with continuous build pipelines this constant thread creation/destruction causes unnecessary overhead. The sccache client only performs simple I/O operations (connecting to server, sending requests, receiving responses) and doesn't need worker threads. This change replaces all client-side Runtime::new() calls with Builder::new_current_thread().enable_all().build() to use a single-threaded runtime, reducing thread count from num_cpus to 1 per client invocation.
e1aea58 to
68adae5
Compare
Will do. Doing a few more tests manually right now. Will add a test before taking this PR out of draft state. |
|
ping ? |
|
Sorry, got caught up with a bunch of things. This is still on my radar. Hope to get to this in the next couple of weeks. |
The sccache client was using Runtime::new() which creates a multi-threaded tokio runtime with worker threads equal to the number of CPU cores. On high-core-count servers running many parallel builds, this created an excessive number of threads.
For example:
While these threads are short-lived, with continuous build pipelines this constant thread creation/destruction causes unnecessary overhead. The sccache client only performs simple I/O operations (connecting to server, sending requests, receiving responses) and doesn't need worker threads.
This change replaces all client-side Runtime::new() calls with Builder::new_current_thread().enable_all().build() to use a single-threaded runtime, reducing thread count from num_cpus to 1 per client invocation.