pub struct Config {
pub worker_threads: usize,
pub max_blocking_threads: usize,
pub catch_panics: bool,
pub read_timeout: Duration,
pub write_timeout: Duration,
pub tcp_nodelay: Option<bool>,
pub storage_directory: PathBuf,
pub maximum_buffer_size: usize,
}Expand description
Configuration for the tokio runtime.
Fields§
§worker_threads: usizeNumber of threads to use for handling async tasks.
Worker threads are always active (waiting for work).
Tokio sets the default value to the number of logical CPUs.
max_blocking_threads: usizeMaximum number of threads to use for blocking tasks.
Unlike worker threads, blocking threads are created as needed and exit if left idle for too long.
Tokio sets the default value to 512 to avoid hanging on lower-level
operations that require blocking (like fs and writing to Stdout).
catch_panics: boolWhether or not to catch panics.
read_timeout: DurationDuration after which to close the connection if no message is read.
write_timeout: DurationDuration after which to close the connection if a message cannot be written.
tcp_nodelay: Option<bool>Whether or not to disable Nagle’s algorithm.
The algorithm combines a series of small network packets into a single packet before sending to reduce overhead of sending multiple small packets which might not be efficient on slow, congested networks. However, to do so the algorithm introduces a slight delay as it waits to accumulate more data. Latency-sensitive networks should consider disabling it to send the packets as soon as possible to reduce latency.
Note: Make sure that your compile target has and allows this configuration otherwise panics or unexpected behaviours are possible.
storage_directory: PathBufBase directory for all storage operations.
maximum_buffer_size: usizeMaximum buffer size for operations on blobs.
Tokio sets the default value to 2MB.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more