Class RpcQosOptions
- All Implemented Interfaces:
Serializable
,HasDisplayData
Every RPC which is sent to Cloud Firestore is subject to QoS considerations. Successful, failed, attempted requests are all tracked and directly drive the determination of when to attempt an RPC.
Configuration of options can be accomplished by passing an instances of RpcQosOptions
to the withRpcQosOptions
method of each Builder
available in FirestoreV1
.
A new instance of RpcQosOptions.Builder
can be created via newBuilder()
. A default instance of RpcQosOptions
can be created via
defaultOptions()
.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Mutable Builder class for creating instances ofRpcQosOptions
. -
Method Summary
Modifier and TypeMethodDescriptionstatic RpcQosOptions
Factory method to return a new instance ofRpcQosOptions
with all default values.boolean
int
The initial size of a batch; used in the absence of the QoS system having significant data to determine a better batch size.long
The maximum number of bytes to include in a batch.int
The maximum number of writes to include in a batch.Target latency for batch requests.int
A hint to the QoS system for the intended max number of workers for a pipeline.The initial backoff duration to be used before retrying a request for the first time.int
The maximum number of times a request will be attempted for a complete successful result.double
The target ratio between requests sent and successful requests.The length of time sampled request data will be retained.The size of buckets within the specifiedsamplePeriod
.The amount of time an attempt will be throttled if deemed necessary based on previous success rate.int
hashCode()
boolean
Whether additional diagnostic metrics should be reported for a Transform.static RpcQosOptions.Builder
Factory method to return a new instance ofRpcQosOptions.Builder
with all values set to their initial default values.void
populateDisplayData
(DisplayData.Builder builder) Register display data for the given transform or component.Create a newRpcQosOptions.Builder
initialized with the values from this instance.toString()
-
Method Details
-
populateDisplayData
Description copied from interface:HasDisplayData
Register display data for the given transform or component.populateDisplayData(DisplayData.Builder)
is invoked by Pipeline runners to collect display data viaDisplayData.from(HasDisplayData)
. Implementations may callsuper.populateDisplayData(builder)
in order to register display data in the current namespace, but should otherwise usesubcomponent.populateDisplayData(builder)
to use the namespace of the subcomponent.- Specified by:
populateDisplayData
in interfaceHasDisplayData
- Parameters:
builder
- The builder to populate with display data.- See Also:
-
getMaxAttempts
public int getMaxAttempts()The maximum number of times a request will be attempted for a complete successful result.For a stream based response, the full stream read must complete within the specified number of attempts. Restarting a stream will count as a new attempt.
Default Value: 5
- See Also:
-
getInitialBackoff
The initial backoff duration to be used before retrying a request for the first time.Default Value: 5 sec
- See Also:
-
getSamplePeriod
The length of time sampled request data will be retained.Default Value: 2 min
- See Also:
-
getSamplePeriodBucketSize
The size of buckets within the specifiedsamplePeriod
.Default Value: 10 sec
- See Also:
-
getOverloadRatio
public double getOverloadRatio()The target ratio between requests sent and successful requests. This is "K" in the formula in SRE Book - Handling OverloadDefault Value: 1.05
- See Also:
-
getThrottleDuration
The amount of time an attempt will be throttled if deemed necessary based on previous success rate.Default value: 5 sec
- See Also:
-
getBatchInitialCount
public int getBatchInitialCount()The initial size of a batch; used in the absence of the QoS system having significant data to determine a better batch size.Default Value: 20
- See Also:
-
getBatchMaxCount
public int getBatchMaxCount()The maximum number of writes to include in a batch. (Used in the absence of the QoS system having significant data to determine a better value). The actual number of writes per request may be lower if we reachbatchMaxBytes
.Default Value: 500
- See Also:
-
getBatchMaxBytes
public long getBatchMaxBytes()The maximum number of bytes to include in a batch. (Used in the absence of the QoS system having significant data to determine a better value). The actual number of bytes per request may be lower ifbatchMaxCount
is reached first.Default Value: 9.5 MiB
- See Also:
-
getBatchTargetLatency
Target latency for batch requests. It aims for a target response time per RPC: the response times for previous RPCs and the number of writes contained in them, calculates a rolling average time-per-write, and chooses the number of writes for future requests to hit the target time.Default Value: 5 sec
- See Also:
-
getHintMaxNumWorkers
public int getHintMaxNumWorkers()A hint to the QoS system for the intended max number of workers for a pipeline. The provided value can be used to try to scale calculations to values appropriate for the pipeline as a whole.If you are running your pipeline on Cloud Dataflow this parameter should be set to the same value as
maxNumWorkers
Default Value: 500
- See Also:
-
isShouldReportDiagnosticMetrics
public boolean isShouldReportDiagnosticMetrics()Whether additional diagnostic metrics should be reported for a Transform.If true, additional detailed diagnostic metrics will be reported for the RPC QoS subsystem.
This parameter should be used with care as it will output ~40 additional custom metrics which will count toward any possible pipeline metrics limits (For example Dataflow Custom Metrics limits and Cloud Monitoring custom metrics quota)
Default Value:
false
- See Also:
-
toBuilder
Create a newRpcQosOptions.Builder
initialized with the values from this instance.- Returns:
- a new
RpcQosOptions.Builder
initialized with the values from this instance.
-
equals
-
hashCode
public int hashCode() -
toString
-
defaultOptions
Factory method to return a new instance ofRpcQosOptions
with all default values.- Returns:
- New instance of
RpcQosOptions
with all default values - See Also:
-
newBuilder
Factory method to return a new instance ofRpcQosOptions.Builder
with all values set to their initial default values.- Returns:
- New instance of
RpcQosOptions.Builder
with all values set to their initial default values - See Also:
-