pub struct RuntimeConfig {
pub thread_count: Option<usize>,
pub jit_threshold: Option<u32>,
pub signal_delivery: SignalDeliveryConfig,
pub completion_retry: CompletionRetryConfig,
pub outbox_enabled: bool,
pub stop_drain_timeout: Duration,
}Expand description
Configuration used when constructing the embedded BEAM runtime.
Fields§
§thread_count: Option<usize>Optional scheduler thread count supplied by the engine builder.
None is passed through to beamr so the embedded runtime applies its own
runtime-aware default.
jit_threshold: Option<u32>Optional JIT compilation threshold supplied by the engine builder.
None is passed through to beamr so the embedded runtime applies its own
default (beamr::jit::profiler::DEFAULT_JIT_THRESHOLD, 1000 recorded
calls per (module, function, arity) at the version this builds against).
Nothing here invents a value.
§Why this is reachable at all
beamr counts calls per MFA and compiles once the count reaches the threshold. Until this field existed the engine held the scheduler and never named the threshold, so the compile point was unreachable from aion — there was no way to move the moment of compilation, and therefore no way to test whether a fault tracks it.
That is what this is for: a proportionality instrument. Halving the threshold should halve the call count at which a compile-correlated fault appears, which predicts a number rather than explaining one. A fault that moves with the threshold is caused by compilation; a fault that does not is not, however well the arithmetic happened to fit.
§🔴 What a large value does, and what it does NOT do
This is not a JIT off-switch, and must not be documented as one.
beamr::jit::profiler::JitProfiler::record_call increments with
saturating_add(1) and then compiles unless new_count < threshold
(jit/profiler.rs:253-262). At u32::MAX the counter saturates at
u32::MAX and the comparison stops being true, so the MFA compiles —
after 4,294,967,295 recorded calls to that one MFA.
Both halves of that sentence are load-bearing. It is a real horizon, not a semantic quibble: at the ~5 calls per durable wait measured on this engine that is ~859 million waits, so a large value genuinely defers compilation past any workload this engine will run. And it is genuinely not “off”: the compile still happens on the other side of that horizon, so anything relying on it never happening is relying on the workload, not on the configuration. beamr’s own scheduler-level disable is the answer to “off”, and it is a separate beamr release; this field cannot stand in for it.
The threshold is stored in an AtomicU32 read by current_threshold
(jit/profiler.rs:109, :189-191). beamr can retune it at runtime via
tune_threshold, but only when an embedder drives that call, and aion
never does — so a value set here is the value that governs.
signal_delivery: SignalDeliveryConfigBounded readiness and retry policy for live signal mailbox delivery.
completion_retry: CompletionRetryConfigUnbounded backoff ladder for durable completion retries.
outbox_enabled: boolWhether the durable-outbox fan-out dispatch path is enabled.
stop_drain_timeout: DurationThe no-progress bound every engine stop path waits under (AE-017). Given by the builder, never derived from signal delivery.
Implementations§
Source§impl RuntimeConfig
impl RuntimeConfig
Sourcepub fn new(thread_count: Option<usize>, stop_drain_timeout: Duration) -> Self
pub fn new(thread_count: Option<usize>, stop_drain_timeout: Duration) -> Self
Create runtime configuration from the builder-supplied scheduler count and stop-drain bound.
stop_drain_timeout is the NO-PROGRESS bound every engine stop path
waits under (AE-017, [crate::runtime::drain_bound]): a drain fails
only when the drained worker has completed nothing for this long. It
is a parameter rather than a field with a default because the runtime
invents no patience of its own — the value is the operator’s, handed
down through the engine builder from the server’s configuration.
Sourcepub const fn with_jit_threshold(self, jit_threshold: Option<u32>) -> Self
pub const fn with_jit_threshold(self, jit_threshold: Option<u32>) -> Self
Override the JIT compilation threshold passed to beamr’s scheduler.
Read Self::jit_threshold before using this. In particular a large
value defers compilation past any realistic workload but does not
disable the JIT, and must not be described as doing so.
Sourcepub const fn with_signal_delivery(
self,
signal_delivery: SignalDeliveryConfig,
) -> Self
pub const fn with_signal_delivery( self, signal_delivery: SignalDeliveryConfig, ) -> Self
Override the signal delivery retry policy.
Sourcepub const fn with_completion_retry(
self,
completion_retry: CompletionRetryConfig,
) -> Self
pub const fn with_completion_retry( self, completion_retry: CompletionRetryConfig, ) -> Self
Override the durable completion-retry backoff ladder.
Sourcepub const fn with_outbox_enabled(self, enabled: bool) -> Self
pub const fn with_outbox_enabled(self, enabled: bool) -> Self
Override whether the durable-outbox fan-out dispatch path is enabled.
Trait Implementations§
Source§impl Clone for RuntimeConfig
impl Clone for RuntimeConfig
Source§fn clone(&self) -> RuntimeConfig
fn clone(&self) -> RuntimeConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RuntimeConfig
Source§impl Debug for RuntimeConfig
impl Debug for RuntimeConfig
impl Eq for RuntimeConfig
Source§impl PartialEq for RuntimeConfig
impl PartialEq for RuntimeConfig
impl StructuralPartialEq for RuntimeConfig
Auto Trait Implementations§
impl Freeze for RuntimeConfig
impl RefUnwindSafe for RuntimeConfig
impl Send for RuntimeConfig
impl Sync for RuntimeConfig
impl Unpin for RuntimeConfig
impl UnsafeUnpin for RuntimeConfig
impl UnwindSafe for RuntimeConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.