pub struct Config {Show 31 fields
pub sq_entries: u32,
pub sqpoll: bool,
pub sqpoll_idle_ms: u32,
pub sqpoll_cpu: Option<u32>,
pub recv_buffer: RecvBufferConfig,
pub udp_recv_buffer: RecvBufferConfig,
pub registered_regions: Vec<MemoryRegion>,
pub worker: WorkerConfig,
pub backlog: i32,
pub max_connections: u32,
pub recv_accumulator_capacity: usize,
pub send_copy_count: u16,
pub send_copy_slot_size: u32,
pub send_slab_slots: u16,
pub flush_interval_us: u64,
pub tick_timeout_us: u64,
pub tls: Option<TlsConfig>,
pub tls_client: Option<TlsClientConfig>,
pub tcp_nodelay: bool,
pub max_chain_length: u16,
pub standalone_task_capacity: u32,
pub timer_slots: u32,
pub udp_bind: Vec<SocketAddr>,
pub udp_send_slots: u16,
pub nvme: Option<NvmeConfig>,
pub direct_io: Option<DirectIoConfig>,
pub fs: Option<FsConfig>,
pub resolver_threads: usize,
pub spawner_threads: usize,
pub blocking_threads: usize,
pub disk_io_threads: usize,
}Expand description
Configuration for the io_uring driver.
Fields§
§sq_entries: u32Number of SQ entries. CQ will be 4x this.
sqpoll: boolEnable SQPOLL mode (kernel-side submission polling).
sqpoll_idle_ms: u32SQPOLL idle timeout in milliseconds.
sqpoll_cpu: Option<u32>Pin SQPOLL kernel thread to this CPU core. Only meaningful when sqpoll=true.
recv_buffer: RecvBufferConfigRecv buffer configuration (provided buffer ring) for TCP multishot recv.
udp_recv_buffer: RecvBufferConfigRecv buffer configuration for UDP multishot recvmsg.
UDP uses a separate provided buffer ring from TCP so the two can be
sized independently. Each buffer must fit an io_uring_recvmsg_out
header (16 bytes) + sockaddr_storage (128 bytes) + the datagram
payload. Default: 128 buffers × 2048 bytes (room for a standard-MTU
datagram plus the multishot metadata); bump buffer_size if you
expect jumbo datagrams.
bgid must differ from recv_buffer.bgid when UDP is in use.
registered_regions: Vec<MemoryRegion>User-registered memory regions (e.g., mmap’d storage arenas).
worker: WorkerConfigWorker/thread configuration.
backlog: i32TCP listen backlog.
max_connections: u32Maximum number of direct file descriptors (connections).
recv_accumulator_capacity: usizeInitial capacity for per-connection recv accumulators.
send_copy_count: u16Number of copy-send pool slots. Each in-flight send() or copy part of a
send_parts() call holds one slot until the kernel completes the send.
Size this to cover your peak in-flight send count — exhaustion returns an
error to the handler. Memory cost: send_copy_count * send_copy_slot_size.
send_copy_slot_size: u32Size of each copy-send pool slot in bytes. A single send() or the
combined copy parts of one send_parts() call must fit in one slot.
send_slab_slots: u16Number of InFlightSendSlab slots for in-flight scatter-gather sends
(i.e., send_parts() calls that include at least one guard).
Each slot is held until all ZC notifications arrive.
flush_interval_us: u64Deadline-based flush interval in microseconds during CQE processing. When non-SQPOLL, if this many microseconds elapse since the last submit while processing a CQE batch, pending SQEs are flushed mid-iteration. 0 = disabled. Ignored when SQPOLL is active (kernel handles it).
tick_timeout_us: u64Maximum time in microseconds that submit_and_wait will block before
returning to call on_tick. Prevents the event loop from stalling when
there are no pending completions (e.g., client-only mode between phases).
0 = no timeout (block indefinitely until a CQE arrives).
Default: 1000 (1ms).
tls: Option<TlsConfig>Optional TLS configuration. When set, all accepted connections use TLS.
tls_client: Option<TlsClientConfig>Optional TLS client configuration for outbound connect_tls() calls.
tcp_nodelay: boolEnable TCP_NODELAY on all connections (accepted and outbound).
max_chain_length: u16Maximum number of SQEs per IOSQE_IO_LINK chain. 0 disables chaining. When disabled, sends exceeding MAX_IOVECS fall back to sequential round-trips (one SQE at a time via on_send_complete). Default: 16.
standalone_task_capacity: u32Maximum number of standalone async tasks (not bound to connections)
per worker. Used with spawn().
Default: 256.
timer_slots: u32§udp_bind: Vec<SocketAddr>UDP bind addresses. Each worker creates its own socket with SO_REUSEPORT. Empty = no UDP sockets.
udp_send_slots: u16Number of concurrent in-flight UDP sends per socket. Each slot owns a
pre-allocated sockaddr_storage + iovec + msghdr triple used to
submit a sendmsg SQE; the slot is returned to the freelist on CQE.
Exhaustion returns crate::error::UdpSendError::PoolExhausted.
Default: 64.
nvme: Option<NvmeConfig>Optional NVMe passthrough configuration. When set, enables NVMe device
management and IORING_OP_URING_CMD submission for direct NVMe I/O.
direct_io: Option<DirectIoConfig>Optional direct I/O configuration. When set, enables O_DIRECT file I/O
via io_uring IORING_OP_READ / IORING_OP_WRITE, bypassing the page cache.
fs: Option<FsConfig>Optional buffered filesystem I/O configuration. When set, enables async file open/read/write/stat/rename/unlink/mkdir via io_uring.
resolver_threads: usizeNumber of dedicated DNS resolver threads. The resolver pool runs
getaddrinfo on background threads, keeping blocking DNS isolated
from the io_uring event loop.
0 = disabled (no resolver pool; resolve() will
return an error). Default: 2.
spawner_threads: usizeNumber of dedicated process spawner threads. The spawner pool runs
posix_spawnp + pidfd_open on background threads, keeping blocking
process creation isolated from the io_uring event loop.
0 = disabled (no spawner pool; Command::spawn()
will return an error). Default: 1.
blocking_threads: usizeNumber of dedicated blocking threads. The blocking pool runs
user-provided closures on low-priority (SCHED_IDLE) background threads,
keeping CPU-bound or blocking work isolated from the io_uring event loop.
0 = disabled (no blocking pool; spawn_blocking()
will return an error). Default: 4.
disk_io_threads: usizeNumber of dedicated disk I/O threads (mio backend only). The disk I/O pool executes blocking filesystem syscalls (pread, pwrite, fsync, stat, rename, unlink, mkdir) on background threads, enabling async file I/O on non-Linux platforms.
0 = disabled (filesystem/direct I/O operations return Unsupported).
Default: 2.