pub struct ResourceBasedTuner<MI> { /* private fields */ }Expand description
Implements crate::worker::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.
Note that different slot types make decisions independently of each other, though they use the same underlying system information.
Implementations§
Source§impl ResourceBasedTuner<RealSysInfo>
impl ResourceBasedTuner<RealSysInfo>
Sourcepub fn new(
target_mem_usage: f64,
target_cpu_usage: f64,
) -> ResourceBasedTuner<RealSysInfo>
pub fn new( target_mem_usage: f64, target_cpu_usage: f64, ) -> ResourceBasedTuner<RealSysInfo>
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,
) -> ResourceBasedTuner<RealSysInfo>
pub fn new_from_options( options: ResourceBasedSlotsOptions, ) -> ResourceBasedTuner<RealSysInfo>
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 ResourceBasedTuner<MI>
pub fn with_workflow_slots_options( &mut self, opts: ResourceSlotOptions, ) -> &mut ResourceBasedTuner<MI>
Set workflow slot options
Sourcepub fn with_activity_slots_options(
&mut self,
opts: ResourceSlotOptions,
) -> &mut ResourceBasedTuner<MI>
pub fn with_activity_slots_options( &mut self, opts: ResourceSlotOptions, ) -> &mut ResourceBasedTuner<MI>
Set activity slot options
Sourcepub fn with_local_activity_slots_options(
&mut self,
opts: ResourceSlotOptions,
) -> &mut ResourceBasedTuner<MI>
pub fn with_local_activity_slots_options( &mut self, opts: ResourceSlotOptions, ) -> &mut ResourceBasedTuner<MI>
Set local activity slot options
Sourcepub fn with_nexus_slots_options(
&mut self,
opts: ResourceSlotOptions,
) -> &mut ResourceBasedTuner<MI>
pub fn with_nexus_slots_options( &mut self, opts: ResourceSlotOptions, ) -> &mut ResourceBasedTuner<MI>
Set nexus slot options
Trait Implementations§
Source§impl<MI> WorkerTuner for ResourceBasedTuner<MI>
impl<MI> WorkerTuner for ResourceBasedTuner<MI>
Source§fn workflow_task_slot_supplier(
&self,
) -> Arc<dyn SlotSupplier<SlotKind = WorkflowSlotKind> + Sync + Send> ⓘ
fn workflow_task_slot_supplier( &self, ) -> Arc<dyn SlotSupplier<SlotKind = WorkflowSlotKind> + Sync + Send> ⓘ
Source§fn activity_task_slot_supplier(
&self,
) -> Arc<dyn SlotSupplier<SlotKind = ActivitySlotKind> + Sync + Send> ⓘ
fn activity_task_slot_supplier( &self, ) -> Arc<dyn SlotSupplier<SlotKind = ActivitySlotKind> + Sync + Send> ⓘ
Source§fn local_activity_slot_supplier(
&self,
) -> Arc<dyn SlotSupplier<SlotKind = LocalActivitySlotKind> + Sync + Send> ⓘ
fn local_activity_slot_supplier( &self, ) -> Arc<dyn SlotSupplier<SlotKind = LocalActivitySlotKind> + Sync + Send> ⓘ
Source§fn nexus_task_slot_supplier(
&self,
) -> Arc<dyn SlotSupplier<SlotKind = NexusSlotKind> + Sync + Send> ⓘ
fn nexus_task_slot_supplier( &self, ) -> Arc<dyn SlotSupplier<SlotKind = NexusSlotKind> + Sync + Send> ⓘ
Auto Trait Implementations§
impl<MI> !RefUnwindSafe for ResourceBasedTuner<MI>
impl<MI> !UnwindSafe for ResourceBasedTuner<MI>
impl<MI> Freeze for ResourceBasedTuner<MI>
impl<MI> Send for ResourceBasedTuner<MI>
impl<MI> Sync for ResourceBasedTuner<MI>
impl<MI> Unpin for ResourceBasedTuner<MI>
impl<MI> UnsafeUnpin 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> 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