pub struct RingSizing { /* private fields */ }Expand description
io_uring sizes for the kernel-TCP transport, derived from the
connection cap by RingSizing::for_max_connections.
u32 ring entries because that is io_uring’s own type for them;
u16 buffers because the buf_ring ABI addresses a buffer by a 16-bit
id (the kernel’s maximum, 32768, fits).
Implementations§
Source§impl RingSizing
impl RingSizing
Sourcepub fn for_max_connections(
max_connections: u64,
) -> Result<Self, MaxConnectionsError>
pub fn for_max_connections( max_connections: u64, ) -> Result<Self, MaxConnectionsError>
Size the rings for a node serving at most max_connections
clients.
Provided buffers are the next power of two at or above two per
connection, with a small floor. Ring entries are the next power of
two at or above two SQEs per connection plus housekeeping, and
strictly above the pool, clamped to
[MIN_RING_ENTRIES, MAX_RING_ENTRIES]. At the default cap
(1024) that is 4096 ring entries and 2048 buffers.
Refuses 0 (formerly “unlimited”: the rings need a bound to be
sized from) and anything above MAX_SUPPORTED_CONNECTIONS.
Sourcepub fn ring_entries(&self) -> u32
pub fn ring_entries(&self) -> u32
Entries in each of the reader’s and the response stage’s submission queues (the completion queue is twice that).
Sourcepub fn provided_buffers(&self) -> u16
pub fn provided_buffers(&self) -> u16
Buffers in the reader’s provided-buffer pool.