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
FieldsModifier and TypeFieldDescriptionprivate doubleprivate longprivate longprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionReplicationThrottler(double bandwidth) ReplicationThrottler constructor If bandwidth less than 1, throttling is disabled -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPushSize(long size) Add current size to the current cycle's total push sizelonggetNextSleepInterval(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.booleanIf throttling is enabledvoidReset the cycle start tick to NOWvoidsetBandwidth(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
-