Class RpcQosOptions
- java.lang.Object
-
- org.apache.beam.sdk.io.gcp.firestore.RpcQosOptions
-
- All Implemented Interfaces:
java.io.Serializable,org.apache.beam.sdk.transforms.display.HasDisplayData
@Immutable @ThreadSafe public final class RpcQosOptions extends java.lang.Object implements java.io.Serializable, org.apache.beam.sdk.transforms.display.HasDisplayDataQuality of Service manager options for Firestore RPCs.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
RpcQosOptionsto thewithRpcQosOptionsmethod of eachBuilderavailable inFirestoreV1.A new instance of
RpcQosOptions.Buildercan be created vianewBuilder(). A default instance ofRpcQosOptionscan be created viadefaultOptions().- See Also:
FirestoreV1,FirestoreV1.Transform.Builder.withRpcQosOptions(RpcQosOptions),FirestoreV1.Transform.Builder.withRpcQosOptions(RpcQosOptions),FirestoreV1.Transform.Builder.withRpcQosOptions(RpcQosOptions),FirestoreV1.Transform.Builder.withRpcQosOptions(RpcQosOptions),FirestoreV1.Transform.Builder.withRpcQosOptions(RpcQosOptions),FirestoreV1.Transform.Builder.withRpcQosOptions(RpcQosOptions), Standard limits, Designing for scale, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRpcQosOptions.BuilderMutable Builder class for creating instances ofRpcQosOptions.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RpcQosOptionsdefaultOptions()Factory method to return a new instance ofRpcQosOptionswith all default values.booleanequals(@Nullable java.lang.Object o)intgetBatchInitialCount()The initial size of a batch; used in the absence of the QoS system having significant data to determine a better batch size.longgetBatchMaxBytes()The maximum number of bytes to include in a batch.intgetBatchMaxCount()The maximum number of writes to include in a batch.org.joda.time.DurationgetBatchTargetLatency()Target latency for batch requests.intgetHintMaxNumWorkers()A hint to the QoS system for the intended max number of workers for a pipeline.org.joda.time.DurationgetInitialBackoff()The initial backoff duration to be used before retrying a request for the first time.intgetMaxAttempts()The maximum number of times a request will be attempted for a complete successful result.doublegetOverloadRatio()The target ratio between requests sent and successful requests.org.joda.time.DurationgetSamplePeriod()The length of time sampled request data will be retained.org.joda.time.DurationgetSamplePeriodBucketSize()The size of buckets within the specifiedsamplePeriod.org.joda.time.DurationgetThrottleDuration()The amount of time an attempt will be throttled if deemed necessary based on previous success rate.inthashCode()booleanisShouldReportDiagnosticMetrics()Whether additional diagnostic metrics should be reported for a Transform.static RpcQosOptions.BuildernewBuilder()Factory method to return a new instance ofRpcQosOptions.Builderwith all values set to their initial default values.voidpopulateDisplayData(org.apache.beam.sdk.transforms.display.DisplayData.Builder builder)RpcQosOptions.BuildertoBuilder()Create a newRpcQosOptions.Builderinitialized with the values from this instance.java.lang.StringtoString()
-
-
-
Method Detail
-
populateDisplayData
public void populateDisplayData(org.apache.beam.sdk.transforms.display.DisplayData.Builder builder)
- Specified by:
populateDisplayDatain interfaceorg.apache.beam.sdk.transforms.display.HasDisplayData
-
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
-
getInitialBackoff
public org.joda.time.Duration getInitialBackoff()
The initial backoff duration to be used before retrying a request for the first time.Default Value: 5 sec
-
getSamplePeriod
public org.joda.time.Duration getSamplePeriod()
The length of time sampled request data will be retained.Default Value: 2 min
-
getSamplePeriodBucketSize
public org.joda.time.Duration getSamplePeriodBucketSize()
The size of buckets within the specifiedsamplePeriod.Default Value: 10 sec
-
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
-
getThrottleDuration
public org.joda.time.Duration getThrottleDuration()
The amount of time an attempt will be throttled if deemed necessary based on previous success rate.Default value: 5 sec
-
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
-
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
-
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 ifbatchMaxCountis reached first.Default Value: 9.5 MiB
-
getBatchTargetLatency
public org.joda.time.Duration 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
-
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
maxNumWorkersDefault Value: 500
-
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
-
toBuilder
public RpcQosOptions.Builder toBuilder()
Create a newRpcQosOptions.Builderinitialized with the values from this instance.- Returns:
- a new
RpcQosOptions.Builderinitialized with the values from this instance.
-
equals
public boolean equals(@Nullable java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
defaultOptions
public static RpcQosOptions defaultOptions()
Factory method to return a new instance ofRpcQosOptionswith all default values.- Returns:
- New instance of
RpcQosOptionswith all default values - See Also:
newBuilder()
-
newBuilder
public static RpcQosOptions.Builder newBuilder()
Factory method to return a new instance ofRpcQosOptions.Builderwith all values set to their initial default values.- Returns:
- New instance of
RpcQosOptions.Builderwith all values set to their initial default values - See Also:
defaultOptions()
-
-