Skip to content

Commit ea675d8

Browse files
committed
Auto merge of #574 - rust-lang:revert-573-exp-delay-on-load, r=pietroalbini
Revert "Back off from running job on high load" ![2021-04-16--13-20-43](https://user-images.githubusercontent.com/2299951/115018861-adae8980-9eb8-11eb-8266-2b80ee44a2ed.png) Reverts #573, as it reduced the performance in prod.
2 parents 94160d1 + 85c0f3d commit ea675d8

File tree

2 files changed

+12
-27
lines changed

2 files changed

+12
-27
lines changed

src/runner/mod.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,17 @@ pub fn run_ex<DB: WriteResults + Sync>(
112112
let mut threads = Vec::new();
113113

114114
for worker in &workers {
115-
let join = scope.builder().name(worker.name().into()).spawn(move || {
116-
match worker.run(threads_count) {
117-
Ok(()) => Ok(()),
118-
Err(r) => {
119-
log::warn!("worker {} failed: {:?}", worker.name(), r);
120-
Err(r)
121-
}
122-
}
123-
})?;
115+
let join =
116+
scope
117+
.builder()
118+
.name(worker.name().into())
119+
.spawn(move || match worker.run() {
120+
Ok(()) => Ok(()),
121+
Err(r) => {
122+
log::warn!("worker {} failed: {:?}", worker.name(), r);
123+
Err(r)
124+
}
125+
})?;
124126
threads.push(join);
125127
}
126128
let disk_watcher_thread =

src/runner/worker.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use std::sync::{
1212
Mutex,
1313
};
1414
use std::time::Duration;
15-
use systemstat::{Platform, System};
1615

1716
pub(super) struct Worker<'a, DB: WriteResults + Sync> {
1817
name: String,
@@ -56,32 +55,16 @@ impl<'a, DB: WriteResults + Sync> Worker<'a, DB> {
5655
&self.name
5756
}
5857

59-
pub(super) fn run(&self, threads_count: usize) -> Fallible<()> {
58+
pub(super) fn run(&self) -> Fallible<()> {
6059
// This uses a `loop` instead of a `while let` to avoid locking the graph too much
6160
let mut guard = self.graph.lock().unwrap();
62-
let system = System::new();
6361
loop {
6462
self.maybe_cleanup_target_dir()?;
6563
let walk_result = guard.next_task(self.ex, self.db, &self.name);
6664
match walk_result {
6765
WalkResult::Task(id, task) => {
6866
drop(guard);
6967
info!("running task: {:?}", task);
70-
71-
// Wait for 15 seconds before running if the 1 minute load
72-
// average exceeds the thread count. This tries to back off
73-
// from spawning too many jobs on the server, hopefully
74-
// improving performance.
75-
loop {
76-
let avg = system.load_average()?;
77-
78-
if avg.one > threads_count as f32 {
79-
std::thread::sleep(std::time::Duration::new(15, 0));
80-
} else {
81-
break;
82-
}
83-
}
84-
8568
let res = task.run(
8669
self.config,
8770
self.workspace,

0 commit comments

Comments
 (0)