Package com.google.api.gax.batching
Class FlowControlEventStats
java.lang.Object
com.google.api.gax.batching.FlowControlEventStats
@InternalApi("For google-cloud-java client use only")
public class FlowControlEventStats
extends Object
Record the statistics of flow control events.
This class is populated by FlowController, which will record throttling events. Currently it only keeps the last flow control event, but it could be expanded to record more information in the future. The events can be used to dynamically adjust concurrency in the client. For example:
// Increase flow control limits if there was throttling in the past 5 minutes and throttled time
// was longer than 1 minute.
while(true) {
FlowControlEvent event = flowControlEventStats.getLastFlowControlEvent();
if (event != null
&& event.getTimestampMs() > System.currentMillis() - TimeUnit.MINUTES.toMillis(5)
&& event.getThrottledTimeInMs() > TimeUnit.MINUTES.toMillis(1)) {
flowController.increaseThresholds(elementSteps, byteSteps);
}
Thread.sleep(TimeUnit.MINUTE.toMillis(10));
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA flow control event. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription
-
Constructor Details
-
FlowControlEventStats
public FlowControlEventStats()
-
-
Method Details
-
getLastFlowControlEvent
-