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 Classes Modifier and Type Class Description static classFlowControlEventStats.FlowControlEventA flow control event.
-
Constructor Summary
Constructors Constructor Description FlowControlEventStats()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FlowControlEventStats.FlowControlEventgetLastFlowControlEvent()
-
-
-
Method Detail
-
getLastFlowControlEvent
public FlowControlEventStats.FlowControlEvent getLastFlowControlEvent()
-
-