@InternalApi(value="For internal usage only") public class ResourceLimiter extends Object
For internal use only - public for technical reasons.
Constructor and Description |
---|
ResourceLimiter(ResourceLimiterStats stats,
long maxHeapSize,
int maxInFlightRpcs)
Constructor for ResourceLimiter.
|
Modifier and Type | Method and 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)
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()
maxHeapSize
.public int getAbsoluteMaxInFlightRpcs()
maxInFlightRpcs
.public int getCurrentInFlightMaxRpcs()
currentInFlightMaxRpcs
.public void setCurrentInFlightMaxRpcs(int currentInFlightMaxRpcs)
currentInFlightMaxRpcs
.public long getHeapSize()
public boolean isFull()
public boolean 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.