mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-06 07:26:43 -04:00
Make core pinning explicit opt-in; disabled by default
This commit is contained in:
@@ -146,9 +146,8 @@ spacetimedb-wasm-instance-env-times = []
|
||||
test = ["spacetimedb-commitlog/test", "spacetimedb-datastore/test"]
|
||||
# Perfmaps for profiling modules
|
||||
perfmap = []
|
||||
# Disables core pinning
|
||||
no-core-pinning = []
|
||||
no-job-core-pinning = []
|
||||
# Enables core pinning.
|
||||
core-pinning = []
|
||||
|
||||
[dev-dependencies]
|
||||
spacetimedb-lib = { path = "../lib", features = ["proptest", "test"] }
|
||||
|
||||
@@ -319,10 +319,10 @@ impl Cores {
|
||||
/// Get the cores of the local host, as reported by the operating system.
|
||||
///
|
||||
/// Returns `None` if `num_cpus` is less than 8
|
||||
/// or if core pinning is disabled.
|
||||
/// or if core pinning is not enabled.
|
||||
/// If `Some` is returned, the `Vec` is non-empty.
|
||||
pub fn get_core_ids() -> Option<Vec<CoreId>> {
|
||||
if cfg!(feature = "no-core-pinning") {
|
||||
if cfg!(not(feature = "core-pinning")) {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ impl JobCores {
|
||||
/// and runs all databases in the `global_runtime`.
|
||||
pub fn from_pinned_cores(cores: impl IntoIterator<Item = CoreId>) -> Self {
|
||||
let cores: IndexMap<_, _> = cores.into_iter().map(|id| (id, CoreInfo::default())).collect();
|
||||
let inner = if cfg!(feature = "no-job-core-pinning") || cores.is_empty() {
|
||||
let inner = if cfg!(not(feature = "core-pinning")) || cores.is_empty() {
|
||||
JobCoresInner::NoPinning
|
||||
} else {
|
||||
JobCoresInner::PinnedCores(Arc::new(Mutex::new(PinnedCoresExecutorManager {
|
||||
|
||||
@@ -21,9 +21,8 @@ unstable = ["spacetimedb-client-api/unstable"]
|
||||
allow_loopback_http_for_tests = ["spacetimedb-core/allow_loopback_http_for_tests"]
|
||||
# Perfmaps for profiling modules
|
||||
perfmap = ["spacetimedb-core/perfmap"]
|
||||
# Disables core pinning
|
||||
no-core-pinning = ["spacetimedb-core/no-core-pinning"]
|
||||
no-job-core-pinning = ["spacetimedb-core/no-job-core-pinning"]
|
||||
# Enables core pinning.
|
||||
core-pinning = ["spacetimedb-core/core-pinning"]
|
||||
|
||||
[dependencies]
|
||||
spacetimedb-client-api-messages.workspace = true
|
||||
|
||||
Reference in New Issue
Block a user