Class ReplicationThrottler
java.lang.Object
org.apache.hadoop.hbase.replication.regionserver.ReplicationThrottler
Per-peer per-node throttling controller for replication: enabled if bandwidth > 0, a cycle =
100ms, by throttling we guarantee data pushed to peer within each cycle won't exceed 'bandwidth'
bytes
-
Field Summary
Modifier and TypeFieldDescriptionprivate double
private long
private long
private boolean
-
Constructor Summary
ConstructorDescriptionReplicationThrottler
(double bandwidth) ReplicationThrottler constructor If bandwidth less than 1, throttling is disabled -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPushSize
(long size) Add current size to the current cycle's total push sizelong
getNextSleepInterval
(int size) Get how long the caller should sleep according to the current size and current cycle's total push size and start tick, return the sleep interval for throttling control.boolean
If throttling is enabledvoid
Reset the cycle start tick to NOWvoid
setBandwidth
(double bandwidth)
-
Field Details
-
enabled
-
bandwidth
-
cyclePushSize
-
cycleStartTick
-
-
Constructor Details
-
ReplicationThrottler
ReplicationThrottler constructor If bandwidth less than 1, throttling is disabled- Parameters:
bandwidth
- per cycle(100ms)
-
-
Method Details
-
isEnabled
If throttling is enabled- Returns:
- true if throttling is enabled
-
getNextSleepInterval
Get how long the caller should sleep according to the current size and current cycle's total push size and start tick, return the sleep interval for throttling control.- Parameters:
size
- is the size of edits to be pushed- Returns:
- sleep interval for throttling control
-
addPushSize
Add current size to the current cycle's total push size- Parameters:
size
- is the current size added to the current cycle's total push size
-
resetStartTick
Reset the cycle start tick to NOW -
setBandwidth
-