Commit e1aea58
committed
fix: use single-threaded tokio runtime in sccache client
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.1 parent a888c16 commit e1aea58
1 file changed
+15
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
| |||
190 | 192 | | |
191 | 193 | | |
192 | 194 | | |
193 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
194 | 198 | | |
195 | 199 | | |
196 | 200 | | |
| |||
624 | 628 | | |
625 | 629 | | |
626 | 630 | | |
627 | | - | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
628 | 634 | | |
629 | 635 | | |
630 | 636 | | |
| |||
760 | 766 | | |
761 | 767 | | |
762 | 768 | | |
763 | | - | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
764 | 772 | | |
765 | 773 | | |
766 | 774 | | |
| |||
804 | 812 | | |
805 | 813 | | |
806 | 814 | | |
807 | | - | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
808 | 818 | | |
809 | 819 | | |
810 | 820 | | |
| |||
0 commit comments