Skip to main content

DriverConfig

Struct DriverConfig 

Source
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: Backend

Which back end to use.

§events: usize

Most 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: usize

Most receives per connection per turn before others get a go (epoll, kqueue, IOCP).

§uring_entries: u32

io_uring: submission queue entries (the completion queue is four times larger).

§uring_buffers: u16

io_uring: entries of the provided-buffer ring (a power of two, at most 32768).

§uring_fixed_files: bool

io_uring: use registered (fixed) file descriptors for connections.

§uring_max_files: u32

io_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: bool

IOCP: 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: usize

IOCP: AcceptEx calls kept outstanding per listener.

§udp_recvs_outstanding: usize

UDP: receives kept outstanding per socket on IOCP.

§busy_poll: Duration

Adaptive 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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DriverConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DriverConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.