Struct xitca_server::Builder
source · pub struct Builder { /* private fields */ }
Implementations§
source§impl Builder
impl Builder
sourcepub fn server_threads(self, num: usize) -> Self
pub fn server_threads(self, num: usize) -> Self
Set number of threads dedicated to accepting connections.
Default set to 1.
§Panics:
When receive 0 as number of server thread.
sourcepub fn worker_threads(self, num: usize) -> Self
pub fn worker_threads(self, num: usize) -> Self
Set number of workers to start.
Default set to available logical cpu as workers count.
§Panics:
When received 0 as number of worker thread.
sourcepub fn worker_max_blocking_threads(self, num: usize) -> Self
pub fn worker_max_blocking_threads(self, num: usize) -> Self
Set max number of threads for each worker’s blocking task thread pool.
One thread pool is set up per worker; not shared across workers.
§Examples:
let builder = Builder::new()
.worker_threads(4) // server has 4 worker threads.
.worker_max_blocking_threads(4); // every worker has 4 max blocking threads.
See tokio::runtime::Builder::max_blocking_threads for behavior reference.
sourcepub fn disable_signal(self) -> Self
pub fn disable_signal(self) -> Self
Disable signal listening. Server would only be shutdown from ServerHandle
sourcepub fn shutdown_timeout(self, secs: u64) -> Self
pub fn shutdown_timeout(self, secs: u64) -> Self
Timeout for graceful workers shutdown in seconds.
After receiving a stop signal, workers have this much time to finish serving requests. Workers still alive after the timeout are force dropped.
By default shutdown timeout sets to 30 seconds.