pub struct ResourceBasedTuner<MI> { /* private fields */ }
Expand description
Implements WorkerTuner and attempts to maintain certain levels of resource usage when under load.
It does so by using two PID controllers, one for memory and one for CPU, which are fed the current usage levels of their respective resource as measurements. The user specifies a target threshold for each, and slots are handed out if the output of both PID controllers is above some defined threshold. See ResourceBasedSlotsOptions for the default PID controller settings.
Implementations§
Source§impl ResourceBasedTuner<RealSysInfo>
impl ResourceBasedTuner<RealSysInfo>
Sourcepub fn new(target_mem_usage: f64, target_cpu_usage: f64) -> Self
pub fn new(target_mem_usage: f64, target_cpu_usage: f64) -> Self
Create an instance attempting to target the provided memory and cpu thresholds as values between 0 and 1.
Sourcepub fn new_from_options(options: ResourceBasedSlotsOptions) -> Self
pub fn new_from_options(options: ResourceBasedSlotsOptions) -> Self
Create an instance using the fully configurable set of PID controller options
Source§impl<MI> ResourceBasedTuner<MI>
impl<MI> ResourceBasedTuner<MI>
Sourcepub fn with_workflow_slots_options(
&mut self,
opts: ResourceSlotOptions,
) -> &mut Self
pub fn with_workflow_slots_options( &mut self, opts: ResourceSlotOptions, ) -> &mut Self
Set workflow slot options
Sourcepub fn with_activity_slots_options(
&mut self,
opts: ResourceSlotOptions,
) -> &mut Self
pub fn with_activity_slots_options( &mut self, opts: ResourceSlotOptions, ) -> &mut Self
Set activity slot options
Sourcepub fn with_local_activity_slots_options(
&mut self,
opts: ResourceSlotOptions,
) -> &mut Self
pub fn with_local_activity_slots_options( &mut self, opts: ResourceSlotOptions, ) -> &mut Self
Set local activity slot options
Sourcepub fn with_nexus_slots_options(
&mut self,
opts: ResourceSlotOptions,
) -> &mut Self
pub fn with_nexus_slots_options( &mut self, opts: ResourceSlotOptions, ) -> &mut Self
Set nexus slot options
Trait Implementations§
Source§impl<MI: SystemResourceInfo + Sync + Send + 'static> WorkerTuner for ResourceBasedTuner<MI>
impl<MI: SystemResourceInfo + Sync + Send + 'static> WorkerTuner for ResourceBasedTuner<MI>
Source§fn workflow_task_slot_supplier(
&self,
) -> Arc<dyn SlotSupplier<SlotKind = WorkflowSlotKind> + Send + Sync>
fn workflow_task_slot_supplier( &self, ) -> Arc<dyn SlotSupplier<SlotKind = WorkflowSlotKind> + Send + Sync>
Source§fn activity_task_slot_supplier(
&self,
) -> Arc<dyn SlotSupplier<SlotKind = ActivitySlotKind> + Send + Sync>
fn activity_task_slot_supplier( &self, ) -> Arc<dyn SlotSupplier<SlotKind = ActivitySlotKind> + Send + Sync>
Source§fn local_activity_slot_supplier(
&self,
) -> Arc<dyn SlotSupplier<SlotKind = LocalActivitySlotKind> + Send + Sync>
fn local_activity_slot_supplier( &self, ) -> Arc<dyn SlotSupplier<SlotKind = LocalActivitySlotKind> + Send + Sync>
Source§fn nexus_task_slot_supplier(
&self,
) -> Arc<dyn SlotSupplier<SlotKind = NexusSlotKind> + Send + Sync>
fn nexus_task_slot_supplier( &self, ) -> Arc<dyn SlotSupplier<SlotKind = NexusSlotKind> + Send + Sync>
Auto Trait Implementations§
impl<MI> Freeze for ResourceBasedTuner<MI>
impl<MI> !RefUnwindSafe for ResourceBasedTuner<MI>
impl<MI> Send for ResourceBasedTuner<MI>
impl<MI> Sync for ResourceBasedTuner<MI>
impl<MI> Unpin for ResourceBasedTuner<MI>
impl<MI> !UnwindSafe for ResourceBasedTuner<MI>
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request