org.apache.cassandra.net

## Class RateBasedBackPressure

- java.lang.Object
- - org.apache.cassandra.net.RateBasedBackPressure

All Implemented Interfaces:
  BackPressureStrategy<org.apache.cassandra.net.RateBasedBackPressureState>

    public class RateBasedBackPressure
    extends java.lang.Object
    implements BackPressureStrategy<org.apache.cassandra.net.RateBasedBackPressureState>

Back-pressure algorithm based on rate limiting according to the ratio between incoming and outgoing rates, computed over a sliding time window with size equal to write RPC timeout.

### Field Summary

Fields
`protected int` `factor`
`protected org.apache.cassandra.net.RateBasedBackPressure.Flow` `flow`
`protected double` `highRatio`
`protected TimeSource` `timeSource`
`protected long` `windowSize`

### Constructor Summary

Constructors
Constructor and Description
`RateBasedBackPressure(java.util.Map<java.lang.String,java.lang.Object> args)`
`RateBasedBackPressure(java.util.Map<java.lang.String,java.lang.Object> args, TimeSource timeSource, long windowSize)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `apply(java.util.Set<org.apache.cassandra.net.RateBasedBackPressureState> states, long timeout, java.util.concurrent.TimeUnit unit)` Applies the back-pressure algorithm, based and acting on the given `BackPressureState`s, and up to the given timeout.
`org.apache.cassandra.net.RateBasedBackPressureState` `newState(java.net.InetAddress host)` Creates a new `BackPressureState` initialized as needed by the specific implementation.
`static ParameterizedClass` `withDefaultParams()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### timeSource

    protected final TimeSource timeSource

#### highRatio

    protected final double highRatio

#### factor

    protected final int factor

#### flow

    protected final org.apache.cassandra.net.RateBasedBackPressure.Flow flow

#### windowSize

    protected final long windowSize

### Constructor Detail

#### RateBasedBackPressure

    public RateBasedBackPressure(java.util.Map<java.lang.String,java.lang.Object> args)

#### RateBasedBackPressure

    public RateBasedBackPressure(java.util.Map<java.lang.String,java.lang.Object> args,
                                 TimeSource timeSource,
                                 long windowSize)

### Method Detail

#### withDefaultParams

    public static ParameterizedClass withDefaultParams()

#### apply

    public void apply(java.util.Set<org.apache.cassandra.net.RateBasedBackPressureState> states,
                      long timeout,
                      java.util.concurrent.TimeUnit unit)

Description copied from interface: `BackPressureStrategy`
Applies the back-pressure algorithm, based and acting on the given `BackPressureState`s, and up to the given timeout.

Specified by:
  `apply` in interface `BackPressureStrategy<org.apache.cassandra.net.RateBasedBackPressureState>`

#### newState

    public org.apache.cassandra.net.RateBasedBackPressureState newState(java.net.InetAddress host)

Description copied from interface: `BackPressureStrategy`
Creates a new `BackPressureState` initialized as needed by the specific implementation.

Specified by:
  `newState` in interface `BackPressureStrategy<org.apache.cassandra.net.RateBasedBackPressureState>`