[−][src]Struct maxim::system::ActorSystemConfig
Configuration structure for the Maxim actor system. Note that this configuration implements serde serialize and deserialize to allow users to read the config from any serde supported means.
Fields
message_channel_size: u16
The default size for the channel that is created for each actor. This can be overridden on a per-actor basis during spawning as well. Making the default channel size bigger allows for more bandwidth in sending messages to actors but also takes more memory. Also the user should consider if their actor needs a large channel then it might need to be refactored or the threads size should be increased because messages aren't being processed fast enough. The default value for this is 32.
send_timeout: Duration
Max duration to wait between attempts to send to an actor's message channel. This is used
to poll a busy channel that is at its capacity limit. The larger this value is, the longer
send
will wait for capacity in the channel but the user should be aware that if the
system is often waiting on capacity that channel may be too small or the actor may need to
be refactored to process messages faster. The default value is 1 millisecond.
thread_pool_size: u16
The size of the thread pool which governs how many worker threads there are in the system. The number of threads should be carefully considered to have sufficient parallelism but not over-schedule the CPU on the target hardware. The default value is 4 * the number of logical CPUs.
warn_threshold: Duration
The threshold at which the dispatcher thread will warn the user that the message took too long to process. If this warning is being logged then the user probably should reconsider how their message processing works and refactor big tasks into a number of smaller tasks. The default value is 1 millisecond.
time_slice: Duration
This controls how long a processor will spend working on messages for an actor before yielding to work on other actors in the system. The dispatcher will continue to pluck messages off the actor's channel and process them until this time slice is exceeded. Note that actors themselves can exceed this in processing a single message and if so, only one message will be processed before yielding. The default value is 1 millisecond.
thread_wait_time: Duration
While Reactors will constantly attempt to get more work, they may run out. At that point,
they will idle for this duration, or until they get a wakeup notification. Said
notifications can be missed, so it's best to not set this too high. The default value is 10
milliseconds. This implementation is backed by a Condvar
.
start_on_launch: bool
Determines whether the actor system will immediately start when it is created. The default value is true.
Methods
impl ActorSystemConfig
[src]
pub fn message_channel_size(self, value: u16) -> Self
[src]
Return a new config with the changed message_channel_size
.
pub fn send_timeout(self, value: Duration) -> Self
[src]
Return a new config with the changed send_timeout
.
pub fn thread_pool_size(self, value: u16) -> Self
[src]
Return a new config with the changed thread_pool_size
.
pub fn warn_threshold(self, value: Duration) -> Self
[src]
Return a new config with the changed warn_threshold
.
pub fn time_slice(self, value: Duration) -> Self
[src]
Return a new config with the changed time_slice
.
pub fn thread_wait_time(self, value: Duration) -> Self
[src]
Return a new config with the changed thread_wait_time
.
Trait Implementations
impl Clone for ActorSystemConfig
[src]
fn clone(&self) -> ActorSystemConfig
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ActorSystemConfig
[src]
impl Default for ActorSystemConfig
[src]
fn default() -> ActorSystemConfig
[src]
Create the config with the default values.
impl<'de> Deserialize<'de> for ActorSystemConfig
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for ActorSystemConfig
[src]
Auto Trait Implementations
impl RefUnwindSafe for ActorSystemConfig
impl Send for ActorSystemConfig
impl Sync for ActorSystemConfig
impl Unpin for ActorSystemConfig
impl UnwindSafe for ActorSystemConfig
Blanket Implementations
impl<T> ActorMessage for T where
T: 'static + Serialize + DeserializeOwned + Sync + Send + Any + ?Sized,
[src]
T: 'static + Serialize + DeserializeOwned + Sync + Send + Any + ?Sized,
fn to_bincode(&Self) -> Result<Vec<u8>, Box<dyn Error + 'static>>
[src]
fn from_bincode(&Vec<u8>) -> Result<T, Box<dyn Error + 'static>>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,