pub struct DriverConfig {
pub backend: Backend,
pub events: usize,
pub recv_budget: usize,
pub uring_entries: u32,
pub uring_buffers: u16,
pub uring_fixed_files: bool,
pub uring_max_files: u32,
pub uring_simulate_failure: Option<i32>,
pub iocp_eager_recv: bool,
pub accepts_outstanding: usize,
pub udp_recvs_outstanding: usize,
pub busy_poll: Duration,
}Expand description
Driver settings. The defaults suit a server loop.
Fields§
§backend: BackendWhich back end to use.
events: usizeMost OS events taken per wait (epoll and kqueue events, IOCP entries). The array starts at 64 entries and doubles, up to this, whenever a wait fills it, so a busy loop drains every ready event in one call and an idle one keeps a small array.
recv_budget: usizeMost receives per connection per turn before others get a go (epoll, kqueue, IOCP).
uring_entries: u32io_uring: submission queue entries (the completion queue is four times larger).
uring_buffers: u16io_uring: entries of the provided-buffer ring (a power of two, at most 32768).
uring_fixed_files: boolio_uring: use registered (fixed) file descriptors for connections.
uring_max_files: u32io_uring: size of the fixed file table (connections per loop that can use it; others use plain descriptors).
uring_simulate_failure: Option<i32>io_uring: pretend io_uring_setup failed with this errno, to test the fallback. The
environment variable SIMOOM_IO_URING_FAIL=<errno> does the same.
iocp_eager_recv: boolIOCP: post receives with a buffer instead of the zero-byte idiom: one system call per receive instead of two, but every connection waiting for data holds a receive buffer. Off by default.
accepts_outstanding: usizeIOCP: AcceptEx calls kept outstanding per listener.
udp_recvs_outstanding: usizeUDP: receives kept outstanding per socket on IOCP.
busy_poll: DurationAdaptive busy polling: after a turn that delivered events, the driver may poll without
blocking for up to this long before it sleeps, saving a sleep and a wake-up when the next
event comes within a few microseconds. It spins only while events have been arriving
sooner than a quarter of this window after busy turns (measured by an occasional probe
spin), so at moderate load it sleeps exactly as without busy polling and costs no CPU per
request; an idle loop never spins. Duration::ZERO turns it off. The environment variable
SIMOOM_BUSY_POLL_US overrides it. Default 30 µs.
Trait Implementations§
Source§impl Clone for DriverConfig
impl Clone for DriverConfig
Source§fn clone(&self) -> DriverConfig
fn clone(&self) -> DriverConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more