@Immutable @ThreadSafe public final class RpcQosOptions extends java.lang.Object implements java.io.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()
.
FirestoreV1
,
FirestoreV1.Transform.Builder.withRpcQosOptions(RpcQosOptions)
,
BatchWriteWithSummary.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 FormModifier and Type | Class and Description |
---|---|
static class |
RpcQosOptions.Builder
Mutable Builder class for creating instances of
RpcQosOptions . |
Modifier and Type | Method and Description |
---|---|
static RpcQosOptions |
defaultOptions()
Factory method to return a new instance of
RpcQosOptions with all default values. |
boolean |
equals(@Nullable java.lang.Object o) |
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.
|
long |
getBatchMaxBytes()
The maximum number of bytes to include in a batch.
|
int |
getBatchMaxCount()
The maximum number of writes to include in a batch.
|
Duration |
getBatchTargetLatency()
Target latency for batch requests.
|
int |
getHintMaxNumWorkers()
A hint to the QoS system for the intended max number of workers for a pipeline.
|
Duration |
getInitialBackoff()
The initial backoff duration to be used before retrying a request for the first time.
|
int |
getMaxAttempts()
The maximum number of times a request will be attempted for a complete successful result.
|
double |
getOverloadRatio()
The target ratio between requests sent and successful requests.
|
Duration |
getSamplePeriod()
The length of time sampled request data will be retained.
|
Duration |
getSamplePeriodBucketSize()
The size of buckets within the specified
samplePeriod . |
Duration |
getThrottleDuration()
The amount of time an attempt will be throttled if deemed necessary based on previous success
rate.
|
int |
hashCode() |
boolean |
isShouldReportDiagnosticMetrics()
Whether additional diagnostic metrics should be reported for a Transform.
|
static RpcQosOptions.Builder |
newBuilder()
Factory method to return a new instance of
RpcQosOptions.Builder with all values set to their initial
default values. |
void |
populateDisplayData(DisplayData.Builder builder)
Register display data for the given transform or component.
|
RpcQosOptions.Builder |
toBuilder()
Create a new
RpcQosOptions.Builder initialized with the values from this instance. |
java.lang.String |
toString() |
public void populateDisplayData(DisplayData.Builder builder)
HasDisplayData
populateDisplayData(DisplayData.Builder)
is invoked by Pipeline runners to collect
display data via DisplayData.from(HasDisplayData)
. Implementations may call super.populateDisplayData(builder)
in order to register display data in the current namespace,
but should otherwise use subcomponent.populateDisplayData(builder)
to use the namespace
of the subcomponent.
populateDisplayData
in interface HasDisplayData
builder
- The builder to populate with display data.HasDisplayData
public int getMaxAttempts()
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
public Duration getInitialBackoff()
Default Value: 5 sec
public Duration getSamplePeriod()
Default Value: 2 min
public Duration getSamplePeriodBucketSize()
samplePeriod
.
Default Value: 10 sec
public double getOverloadRatio()
Default Value: 1.05
public Duration getThrottleDuration()
Default value: 5 sec
public int getBatchInitialCount()
Default Value: 20
public int getBatchMaxCount()
batchMaxBytes
.
Default Value: 500
public long getBatchMaxBytes()
batchMaxCount
is reached first.
Default Value: 9.5 MiB
public Duration getBatchTargetLatency()
Default Value: 5 sec
public int getHintMaxNumWorkers()
If you are running your pipeline on Cloud Dataflow this parameter should be set to the
same value as maxNumWorkers
Default Value: 500
public boolean isShouldReportDiagnosticMetrics()
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
public RpcQosOptions.Builder toBuilder()
RpcQosOptions.Builder
initialized with the values from this instance.RpcQosOptions.Builder
initialized with the values from this instance.public boolean equals(@Nullable java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static RpcQosOptions defaultOptions()
RpcQosOptions
with all default values.RpcQosOptions
with all default valuesnewBuilder()
public static RpcQosOptions.Builder newBuilder()
RpcQosOptions.Builder
with all values set to their initial
default values.RpcQosOptions.Builder
with all values set to their initial default valuesdefaultOptions()