[−][src]Struct rocks::rate_limiter::RateLimiter
RateLimiter
object, which can be shared among RocksDB instances to
control write rate of flush and compaction.
Implementations
impl RateLimiter
[src]
pub fn new(
rate_bytes_per_sec: i64,
refill_period_us: i64,
fairness: i32
) -> RateLimiter
[src]
rate_bytes_per_sec: i64,
refill_period_us: i64,
fairness: i32
) -> RateLimiter
Create a RateLimiter object, which can be shared among RocksDB instances to control write rate of flush and compaction.
rate_bytes_per_sec
: this is the only parameter you want to set most of the
time. It controls the total write rate of compaction and flush in bytes per
second. Currently, RocksDB does not enforce rate limit for anything other
than flush and compaction, e.g. write to WAL.
refill_period_us
: this controls how often tokens are refilled. For example,
when rate_bytes_per_sec is set to 10MB/s and refill_period_us is set to
100ms, then 1MB is refilled every 100ms internally. Larger value can lead to
burstier writes while smaller value introduces more CPU overhead.
The default should work for most cases.
fairness
: RateLimiter accepts high-pri requests and low-pri requests.
A low-pri request is usually blocked in favor of hi-pri request. Currently,
RocksDB assigns low-pri to request from compaciton and high-pri to request
from flush. Low-pri requests can get blocked if flush requests come in
continuouly. This fairness parameter grants low-pri requests permission by
1/fairness chance even though high-pri requests exist to avoid starvation.
Trait Implementations
impl Drop for RateLimiter
[src]
Auto Trait Implementations
impl RefUnwindSafe for RateLimiter
[src]
impl !Send for RateLimiter
[src]
impl !Sync for RateLimiter
[src]
impl Unpin for RateLimiter
[src]
impl UnwindSafe for RateLimiter
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,