logo

Struct actix_server::ServerBuilder[][src]

pub struct ServerBuilder { /* fields omitted */ }
Expand description

Server builder.

Implementations

Create new Server builder instance

Set number of workers to start.

num must be greater than 0.

The default worker count is the number of physical CPU cores available. If your benchmark testing indicates that simultaneous multi-threading is beneficial to your app, you can use the num_cpus crate to acquire the logical core count instead.

Set max number of threads for each worker’s blocking task thread pool.

One thread pool is set up per worker; not shared across workers.

Examples:
let builder = ServerBuilder::new()
    .workers(4) // server has 4 worker thread.
    .worker_max_blocking_threads(4); // every worker has 4 max blocking threads.

See tokio::runtime::Builder::max_blocking_threads for behavior reference.

Set the maximum number of pending connections.

This refers to the number of clients that can be waiting to be served. Exceeding this number results in the client getting an error when attempting to connect. It should only affect servers under significant load.

Generally set in the 64-2048 range. Default value is 2048.

This method should be called before bind() method call.

Sets the maximum per-worker number of concurrent connections.

All socket listeners will stop accepting connections when this limit is reached for each worker.

By default max connections is set to a 25k per worker.

Stop Actix System after server shutdown.

Disable OS signal handling.

Timeout for graceful workers shutdown in seconds.

After receiving a stop signal, workers have this much time to finish serving requests. Workers still alive after the timeout are force dropped.

By default shutdown timeout sets to 30 seconds.

Add new service to the server.

Add new service to the server.

Starts processing incoming connections and return server controller.

Trait Implementations

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.