public class GenericRateLimiterConfig extends RateLimiterConfig
RateLimiterConfig
Constructor and Description |
---|
GenericRateLimiterConfig(long rateBytesPerSecond)
GenericRateLimiterConfig constructor
|
GenericRateLimiterConfig(long rateBytesPerSecond,
long refillPeriodMicros,
int fairness)
GenericRateLimiterConfig constructor
|
Modifier and Type | Method and Description |
---|---|
protected long |
newRateLimiterHandle()
This function should only be called by
DBOptions.setRateLimiter(long, long) , which will
create a c++ shared-pointer to the c++ RateLimiter that is associated
with a Java RateLimiterConfig. |
public GenericRateLimiterConfig(long rateBytesPerSecond, long refillPeriodMicros, int fairness)
rateBytesPerSecond
- 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.refillPeriodMicros
- 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 compaction and high-pri to request
from flush. Low-pri requests can get blocked if flush requests come in
continuously. This fairness parameter grants low-pri requests permission by
fairness chance even though high-pri requests exist to avoid starvation.
You should be good by leaving it at default 10.public GenericRateLimiterConfig(long rateBytesPerSecond)
rateBytesPerSecond
- 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.protected long newRateLimiterHandle()
RateLimiterConfig
DBOptions.setRateLimiter(long, long)
, which will
create a c++ shared-pointer to the c++ RateLimiter
that is associated
with a Java RateLimiterConfig.newRateLimiterHandle
in class RateLimiterConfig
DBOptions.setRateLimiter(long, long)