org.apache.hadoop.hbase.replication.regionserver
Class ReplicationThrottler

java.lang.Object
  extended by org.apache.hadoop.hbase.replication.regionserver.ReplicationThrottler

@InterfaceAudience.Private
public class ReplicationThrottler
extends Object

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


Constructor Summary
ReplicationThrottler(double bandwidth)
          ReplicationThrottler constructor If bandwidth less than 1, throttling is disabled
 
Method Summary
 void addPushSize(int size)
          Add current size to the current cycle's total push size
 long 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 isEnabled()
          If throttling is enabled
 void resetStartTick()
          Reset the cycle start tick to NOW
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplicationThrottler

public ReplicationThrottler(double bandwidth)
ReplicationThrottler constructor If bandwidth less than 1, throttling is disabled

Parameters:
bandwidth - per cycle(100ms)
Method Detail

isEnabled

public boolean isEnabled()
If throttling is enabled

Returns:
true if throttling is enabled

getNextSleepInterval

public long 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.

Parameters:
size - is the size of edits to be pushed
Returns:
sleep interval for throttling control

addPushSize

public void addPushSize(int size)
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

public void resetStartTick()
Reset the cycle start tick to NOW



Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.