public class ResourceLimiter extends Object
Constructor | Description |
---|---|
ResourceLimiter(ResourceLimiterStats stats,
long maxHeapSize,
int maxInFlightRpcs) |
Constructor for ResourceLimiter.
|
Modifier and Type | Method | Description |
---|---|---|
int |
getAbsoluteMaxInFlightRpcs() |
Getter for the field
maxInFlightRpcs . |
int |
getCurrentInFlightMaxRpcs() |
Getter for the field
currentInFlightMaxRpcs . |
long |
getHeapSize() |
getHeapSize.
|
long |
getMaxHeapSize() |
Getter for the field
maxHeapSize . |
boolean |
hasInflightRequests() |
hasInflightRequests.
|
boolean |
isFull() |
isFull.
|
void |
markCanBeCompleted(long id) |
Mark an operation id, as returned by
registerOperationWithHeapSize , as complete |
long |
registerOperationWithHeapSize(long heapSize) |
Register an operation with the given size before sending.
|
void |
setCurrentInFlightMaxRpcs(int currentInFlightMaxRpcs) |
Setter for the field
currentInFlightMaxRpcs . |
void |
throttle(int bulkMutationRpcTargetMs) |
Enable an experimental feature that will throttle requests made from
BulkMutation . |
public ResourceLimiter(ResourceLimiterStats stats, long maxHeapSize, int maxInFlightRpcs)
Constructor for ResourceLimiter.
maxHeapSize
- a long.maxInFlightRpcs
- a int.public long registerOperationWithHeapSize(long heapSize) throws InterruptedException
markCanBeCompleted
in order to make sure
resources are properly released.heapSize
- The serialized size of the RPC to be sentInterruptedException
- if any.public void markCanBeCompleted(long id)
registerOperationWithHeapSize
, as completeid
- a long.public long getMaxHeapSize()
Getter for the field maxHeapSize
.
public int getAbsoluteMaxInFlightRpcs()
Getter for the field maxInFlightRpcs
.
public int getCurrentInFlightMaxRpcs()
Getter for the field currentInFlightMaxRpcs
.
public void setCurrentInFlightMaxRpcs(int currentInFlightMaxRpcs)
Setter for the field currentInFlightMaxRpcs
.
public long getHeapSize()
getHeapSize.
public boolean isFull()
isFull.
public boolean hasInflightRequests()
hasInflightRequests.
public void throttle(int bulkMutationRpcTargetMs)
BulkMutation
. The
logic is as follows:
if (rpc_latency > threshold) { decrease parallelism by 10% of original maximum. } else if (rpc_latency < threshold && rpcsWereThrottled()) { increase parallelism by 5% of original maximum. }NOTE: increases are capped by the initial maximum. Decreases are floored at 1% of the original maximum so that there is some level of throughput.
bulkMutationRpcTargetMs
- the target for latency of MutateRows requests in milliseconds.