pub struct Server { /* private fields */ }
Implementations§
Source§impl Server
impl Server
Sourcepub fn tcp_nodelay(&mut self, no_delay: bool) -> &mut Self
pub fn tcp_nodelay(&mut self, no_delay: bool) -> &mut Self
Configure tcp_nodelay
setting for each server socket.
Default: false
From mio::net::TcpStream
docs:
Sets the value of the TCP_NODELAY option on this socket. If set, this option disables the Nagle algorithm. This means that segments are always sent as soon as possible, even if there is only a small amount of data. When not set, data is buffered until there is a sufficient amount to send out, thereby avoiding the frequent sending of small packets.
Note: tcp_nodelay(true)
will significantly improve performance
for benchmarking loads, but may not be necessary for real world usage.
For example on my laptop, wrk -t2 -c100
increases from 2.5k to 92k req/s.
Sourcepub fn pool_size(&mut self, pool_size: usize) -> &mut Self
pub fn pool_size(&mut self, pool_size: usize) -> &mut Self
Configure the size of the thread pool that’s used for executing handlers
Defaults to num_cpus * 8
. If zero is specified, unlimited threads will
be spawned instead of using a thread pool.
Sourcepub fn set_keepalive_secs(&mut self, keep_alive_secs: u64) -> &mut Self
pub fn set_keepalive_secs(&mut self, keep_alive_secs: u64) -> &mut Self
Configure keep-alive timeout in seconds
Defaults to 5 seconds