pub struct ServerConfig {
pub max_connections: usize,
pub max_h2_streams: u32,
pub workers: Option<usize>,
pub header_read_timeout: Option<Duration>,
pub body_read_timeout: Option<Duration>,
pub connection_timeout: Option<Duration>,
pub drain_timeout: Duration,
pub enable_http2: bool,
}Expand description
Configuration for the monoio server.
Fields§
§max_connections: usizeMaximum number of concurrent connections. Default: 8192.
max_h2_streams: u32Maximum concurrent HTTP/2 streams per connection. Default: 256.
workers: Option<usize>Total worker threads for the high-level run / start APIs.
None defaults to std::thread::available_parallelism(). The async
serve* APIs always run on a single monoio runtime and will reject
values greater than 1.
header_read_timeout: Option<Duration>Timeout for reading HTTP headers from a new connection. Default: Some(5s).
body_read_timeout: Option<Duration>Timeout for reading request bodies after headers are complete. Default: Some(30s).
connection_timeout: Option<Duration>Maximum lifetime of a single connection. Default: Some(5 min).
drain_timeout: DurationTime to wait for in-flight requests to complete during shutdown. Default: 30s.
enable_http2: boolEnable HTTP/2 support (prior knowledge). Default: false.
When enabled, connections are assumed to use HTTP/2 directly (no protocol negotiation). This is suitable for internal services or load balancers that route H2 traffic to dedicated ports.
Trait Implementations§
Source§impl Clone for ServerConfig
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more