Skip to content

Commit

Permalink
update min user backlog
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Mar 17, 2024
1 parent 037c20d commit 1fe5148
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,10 @@ impl QueueActor {
let system_wait = system_backlog
.checked_sub(status.system.oldest)
.unwrap_or_default();
self.logger.debug(&format!("User wait: {:?} due to {:?} for oldest {:?}, system wait: {:?} due to {:?} for oldest {:?}",
user_wait, user_backlog, status.user.oldest,
system_wait, system_backlog, status.system.oldest));
let slow = user_wait >= system_wait + sec;
self.logger.debug(&format!("User wait: {:?} due to {:?} for oldest {:?}, system wait: {:?} due to {:?} for oldest {:?} -> {}",
user_wait, user_backlog, status.user.oldest,
system_wait, system_backlog, status.system.oldest, if slow { "system" } else { "user" }));
(min(user_wait, system_wait), AcquireQuery { slow })
} else {
self.logger
Expand Down
8 changes: 4 additions & 4 deletions src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ impl StatsRecorder {
}

pub fn min_user_backlog(&self) -> Duration {
// The average batch has 60 positions, analysed with 2_000_000 nodes
// each. Top end clients take no longer than 35 seconds.
let best_batch_seconds = 35;
// The average batch has 60 positions, analysed with 1_500_000 nodes
// each. Top end clients take no longer than 60 seconds.
let best_batch_seconds = 60;

// Estimate how long this client would take for the next batch,
// capped at timeout.
let estimated_batch_seconds =
u64::from(min(6 * 60, 60 * 2_000_000 / max(1, self.nnue_nps.nps)));
u64::from(min(6 * 60, 60 * 1_500_000 / max(1, self.nnue_nps.nps)));

// Its worth joining if queue wait time + estimated time < top client
// time on empty queue.
Expand Down

0 comments on commit 1fe5148

Please sign in to comment.