Struct tk_carbon::Config
[−]
[src]
pub struct Config { /* fields omitted */ }
Configuration of carbon protocol
This configuration is used both for single connection and connection pool.
Methods
impl Config
[src]
fn new() -> Config
[src]
Create the config builder with all defaults
fn reconnect_delay(&mut self, delay: Duration) -> &mut Self
[src]
Set the reconnect delay
Actual delay is chosen each time as a random millisecond from 0.5 of this value to 1.5 for this value.
Note: reconnect delay is calculated since previous connection attempt. I.e. if connection is broken after a minute of normal work it will reconnect immediately.
fn reconnect_delay_min_max(
&mut self,
min_delay: Duration,
max_delay: Duration
) -> &mut Self
[src]
&mut self,
min_delay: Duration,
max_delay: Duration
) -> &mut Self
Set the reconnect delay bounds to more specific values
Actual delay is chosen each time as a random millisecond
from the range of min_delay..max_delay
. Usually it's enough to set
reconnect_delay
but you can use this method if you need more tight
control.
Note: reconnect delay is calculated since previous connection attempt. I.e. if connection is broken after a minute of normal work it will reconnect immediately.
fn write_timeout(&mut self, dur: Duration) -> &mut Self
[src]
Timeout of writing at least some byte when there are any bytes in the outgoing buffer
fn watermarks(&mut self, low: usize, high: usize) -> &mut Self
[src]
Buffer limits or watermarks
The rules of thumb to not to loose any metrics:
- Low watermark is efficient buffer size for sending to network
- High watermark is maximum buffer size, should be much larger to compensate when individual host becomes slower
Details
When number of bytes buffered reaches low watermark (in all
connections) we stop pulling metrics from the internal channel.
The latter will start to drop messages after max_metrics_buffered
is reached.
When number of bytes buffered reaches high watermark in any specific
connection we drop connection entirely, as this means connection can't
keep up with the traffic (but write_timeout
has not reached for
some reason, for example it accepts bytes in small chunks).
High water mark should be at least one metric larger than low watermark or connection will be dropped whenever watermark is reached. For single connection high watermark should still be higher, but otherwise there is no chance it will be reached beyond single metric.
Panics
Panics if high watermark is smaller than low watermark or watermark is zero.
fn max_metrics_buffered(&mut self, metrics: usize) -> &mut Self
[src]
Maximum metrics buffered in a channel
The rule of thumb: this channel should contain as much metrics as might be sent within the period of the downtime + reconnect time for the carbon backend (in order to not to loose any values). Probably 10 seconds or 30 seconds worth of metrics at least.
This buffer is common for all the underlying channel between Carbon
instance and the actual Proto
or Pool
. This channel is single
one for all underlying connections.
fn done(&mut self) -> Arc<Config>
[src]
Create a Arc'd config clone to pass to the constructor
This is just a convenience method.
Trait Implementations
impl Clone for Config
[src]
fn clone(&self) -> Config
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more