Skip to content

Commit e0e0c39

Browse files
Reserve cores 0 and 1 for the OS
1 parent 0866fd3 commit e0e0c39

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

crates/core/src/startup.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use core_affinity::CoreId;
22
use crossbeam_queue::ArrayQueue;
3+
use itertools::Itertools;
34
use spacetimedb_paths::server::{ConfigToml, LogsDir};
45
use std::path::PathBuf;
56
use std::time::Duration;
@@ -194,7 +195,14 @@ pub struct Cores {
194195
impl Cores {
195196
fn get() -> Option<Self> {
196197
let cores = &mut core_affinity::get_core_ids()
197-
.filter(|cores| cores.len() >= 8)?
198+
.filter(|cores| cores.len() >= 10)?
199+
.into_iter()
200+
// We reserve the first two cores for the OS.
201+
// This allows us to pin interrupt handlers (IRQs) to these cores,
202+
// particularly those for incoming network traffic,
203+
// preventing them from preempting the main reducer threads.
204+
.filter(|core_id| core_id.id > 1)
205+
.collect_vec()
198206
.into_iter();
199207

200208
let total = cores.len() as f64;

0 commit comments

Comments
 (0)