Skip to content

fix: use single-threaded tokio runtime in sccache (dist-)client#2704

Open
AJIOB wants to merge 2 commits into
mozilla:mainfrom
AJIOB:single-threaded-client
Open

fix: use single-threaded tokio runtime in sccache (dist-)client#2704
AJIOB wants to merge 2 commits into
mozilla:mainfrom
AJIOB:single-threaded-client

Conversation

@AJIOB
Copy link
Copy Markdown
Contributor

@AJIOB AJIOB commented May 11, 2026

It's the #2460 follow-up with dist-client similar fixes.

Thanks, @venkyt-arista, for the original fix

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 11, 2026

Codecov Report

❌ Patch coverage is 42.85714% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.32%. Comparing base (8825b4a) to head (741976e).

Files with missing lines Patch % Lines
src/commands.rs 60.00% 6 Missing ⚠️
src/dist/client_auth.rs 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2704      +/-   ##
==========================================
- Coverage   74.41%   74.32%   -0.09%     
==========================================
  Files          70       70              
  Lines       39211    39388     +177     
==========================================
+ Hits        29177    29277     +100     
- Misses      10034    10111      +77     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AJIOB AJIOB changed the title Single threaded client fix: use single-threaded tokio runtime in sccache (dist-)client May 11, 2026
@AJIOB AJIOB force-pushed the single-threaded-client branch from 775b781 to 15cec8f Compare May 11, 2026 07:07
venkyt-arista and others added 2 commits May 17, 2026 17:29
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.
The reason for that is described in the previous commit
@AJIOB AJIOB force-pushed the single-threaded-client branch from 15cec8f to 741976e Compare May 17, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants