Struct mini_http::Server
[−]
[src]
pub struct Server { /* fields omitted */ }
Methods
impl Server
[src]
fn new(addr: &str) -> Result<Self>
[src]
Initialize a new default Server
to run on addr
fn tcp_nodelay(&mut self, no_delay: bool) -> &mut Self
[src]
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.
fn pool_size(&mut self, pool_size: usize) -> &mut Self
[src]
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.
fn set_keepalive_secs(&mut self, keep_alive_secs: u64) -> &mut Self
[src]
Configure keep-alive timeout in seconds
Defaults to 5 seconds
fn start<F>(&self, func: F) -> Result<()> where
F: Send + Sync + 'static + Fn(Request) -> Response<Vec<u8>>,
[src]
F: Send + Sync + 'static + Fn(Request) -> Response<Vec<u8>>,
Start the server using the given handler function