logo

Struct remoc::Cfg

source · []
pub struct Cfg {
    pub connection_timeout: Option<Duration>,
    pub max_ports: u32,
    pub ports_exhausted: PortsExhausted,
    pub max_data_size: usize,
    pub max_received_ports: usize,
    pub chunk_size: u32,
    pub receive_buffer: u32,
    pub shared_send_queue: usize,
    pub transport_send_queue: usize,
    pub transport_receive_queue: usize,
    pub connect_queue: u16,
    /* private fields */
}
Expand description

Channel multiplexer configuration.

In most cases the default configuration (Cfg::default) is recommended, since it provides a good balance between throughput, memory usage and latency.

In case of unsatisfactory performance (low throughput) your first step should be to increase the receive buffer size.

Fields

connection_timeout: Option<Duration>

Time after which connection is closed when no data is.

Pings are send automatically when this is enabled and no data is transmitted. By default this is 60 seconds.

max_ports: u32

Maximum number of open ports.

This must not exceed 2^31 = 2147483648. By default this is 16384.

ports_exhausted: PortsExhausted

Default behavior when ports are exhausted and a connect is requested.

This can be overridden on a per-request basis. By default this is wait with a timeout of 60 seconds.

max_data_size: usize

Maximum size of received data per message in bytes.

Receiver::recv_chunk is not affected by this limit.

Remote channels will spawn a serialization and deserialization thread to transmit and receive data in chunks if this limit is reached. Thus, this does not limit the maximum serialized data size for remote channels but will incur a small performance cost for inter-thread communication when exceeded.

This can be configured on a per-receiver basis. By default this is 512 kB.

max_received_ports: usize

Maximum port requests received per message.

For remote channels this configures how many more ports than expected (from the data type) can be received per message. This is useful for compatibility when the receiver has an older version of a struct type with less fields containing ports.

This can be configured on a per-receiver basis. By default this is 128.

chunk_size: u32

Size of a chunk of data in bytes.

By default this is 16 kB. This must be at least 4 bytes. This must not exceed 2^32 - 16 = 4294967279.

receive_buffer: u32

Size of receive buffer of each port in bytes.

This controls the maximum amout of in-flight data per port, that is data on the transport plus received but yet unprocessed data.

Increase this value if the throughput (bytes per second) is significantly lower than you would expect from your underlying transport connection.

By default this is 512 kB. This must be at least 4 bytes.

shared_send_queue: usize

Length of global send queue. Each element holds a chunk.

This limits the number of chunks sendable by using Sender::try_send. It will not affect remote channels.

By default this is 16. This must not be zero.

transport_send_queue: usize

Length of transport send queue. Each element holds a chunk.

Raising this may improve performance but might incur a slight increase in latency. For minimum latency this should be set to 1.

By default this is 16. This must not be zero.

transport_receive_queue: usize

Length of transport receive queue. Each element holds a chunk.

Raising this may improve performance but might incur a slight increase in latency. For minimum latency this should be set to 1.

By default this is 16. This must not be zero.

connect_queue: u16

Maximum number of outstanding connection requests.

By default this is 128. This must not be zero.

Implementations

Returns the maximum size of a frame that can be received by a channel multiplexer using this configuration.

Panics

Panics if the configuration is invalid.

Configuration that is balanced between memory usage, latency and throughput.

Configuration that is optimized for low memory usage and low latency but may be throughput-limited.

Configuration that is throughput-optimized but may use more memory per channel and may have higher latency.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The default configuration provides a balance between throughput, memory usage and latency.

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. 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.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more