Class ReplicationThrottler

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

@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
  • Field Details

  • Constructor Details

    • ReplicationThrottler

      public ReplicationThrottler(double bandwidth)
      ReplicationThrottler constructor If bandwidth less than 1, throttling is disabled
      Parameters:
      bandwidth - per cycle(100ms)
  • Method Details

    • 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(long 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
    • setBandwidth

      public void setBandwidth(double bandwidth)