public static final class RpcQosOptions.Builder
extends java.lang.Object
RpcQosOptions
.
A new instance of RpcQosOptions.Builder
can be created via RpcQosOptions.newBuilder()
.
NOTE: All with
methods in this class function as set rather than copy with
new value
Modifier and Type | Method and Description |
---|---|
RpcQosOptions |
build()
Create a new instance of
RpcQosOptions from the current builder state. |
RpcQosOptions.Builder |
withBatchInitialCount(int batchInitialCount)
Configure the initial size of a batch; used in the absence of the QoS system having
significant data to determine a better batch size.
|
RpcQosOptions.Builder |
withBatchMaxBytes(long batchMaxBytes)
Configure the maximum number of bytes to include in a batch.
|
RpcQosOptions.Builder |
withBatchMaxCount(int batchMaxCount)
Configure the maximum number of writes to include in a batch.
|
RpcQosOptions.Builder |
withBatchTargetLatency(Duration batchTargetLatency)
Target latency for batch requests.
|
RpcQosOptions.Builder |
withHintMaxNumWorkers(int hintMaxNumWorkers)
Provide a hint to the QoS system for the intended max number of workers for a pipeline.
|
RpcQosOptions.Builder |
withInitialBackoff(Duration initialBackoff)
Configure the initial backoff duration to be used before retrying a request for the first
time.
|
RpcQosOptions.Builder |
withMaxAttempts(int maxAttempts)
Configure the maximum number of times a request will be attempted for a complete successful
result.
|
RpcQosOptions.Builder |
withOverloadRatio(double overloadRatio)
The target ratio between requests sent and successful requests.
|
RpcQosOptions.Builder |
withReportDiagnosticMetrics()
Whether additional diagnostic metrics should be reported for a Transform.
|
RpcQosOptions.Builder |
withSamplePeriod(Duration samplePeriod)
Configure the length of time sampled request data will be retained.
|
RpcQosOptions.Builder |
withSamplePeriodBucketSize(Duration samplePeriodBucketSize)
Configure the size of buckets within the specified
samplePeriod . |
RpcQosOptions.Builder |
withThrottleDuration(Duration throttleDuration)
Configure the amount of time an attempt will be throttled if deemed necessary based on
previous success rate.
|
public RpcQosOptions.Builder withMaxAttempts(int maxAttempts)
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
maxAttempts
- an int in the range 1 <= maxAttempts
<= 5RpcQosOptions.getMaxAttempts()
public RpcQosOptions.Builder withInitialBackoff(Duration initialBackoff)
Default Value: 5 sec
initialBackoff
- a Duration
in the range 5 sec <= initialBackoff
<= 2
minRpcQosOptions.getInitialBackoff()
public RpcQosOptions.Builder withSamplePeriod(Duration samplePeriod)
Default Value: 2 min
samplePeriod
- a Duration
in the range 2 min <= samplePeriod
<= 20 minRpcQosOptions.getSamplePeriod()
public RpcQosOptions.Builder withSamplePeriodBucketSize(Duration samplePeriodBucketSize)
samplePeriod
.
Default Value: 10 sec
samplePeriodBucketSize
- a Duration
in the range 10 sec <= samplePeriodBucketSize
<= 20 minRpcQosOptions.getSamplePeriodBucketSize()
public RpcQosOptions.Builder withOverloadRatio(double overloadRatio)
Default Value: 1.05
overloadRatio
- the target ratio between requests sent and successful requests. A double
in the range 1.0 <= overloadRatio
<= 1.5RpcQosOptions.getOverloadRatio()
public RpcQosOptions.Builder withThrottleDuration(Duration throttleDuration)
Default value: 5 sec
throttleDuration
- a Duration
in the range 5 sec <= throttleDuration
<=
1 minRpcQosOptions.getThrottleDuration()
public RpcQosOptions.Builder withBatchInitialCount(int batchInitialCount)
Default Value: 20
batchInitialCount
- an int in the range 1 <= batchInitialCount
<= 500RpcQosOptions.getBatchInitialCount()
public RpcQosOptions.Builder withBatchMaxCount(int batchMaxCount)
batchMaxBytes
is reached first.
Default Value: 500
batchMaxCount
- an int in the range 1 <= batchMaxCount
<= 500RpcQosOptions.getBatchMaxCount()
public RpcQosOptions.Builder withBatchMaxBytes(long batchMaxBytes)
batchMaxCount
is reached first.
Default Value: 9.5 MiB
batchMaxBytes
- an int in the range 1 B <= batchMaxBytes
<= 9.5 MiBRpcQosOptions.getBatchMaxBytes()
public RpcQosOptions.Builder withBatchTargetLatency(Duration batchTargetLatency)
Default Value: 5 sec
batchTargetLatency
- a Duration
in the range 5 sec <= batchTargetLatency
<= 2 minRpcQosOptions.getBatchTargetLatency()
public RpcQosOptions.Builder withHintMaxNumWorkers(int hintMaxNumWorkers)
If you are running your pipeline on Cloud Dataflow this parameter should be set to
the same value as maxNumWorkers
Default Value: 500
hintMaxNumWorkers
- an int in the range 1 <= hintMaxNumWorkers
<=
Integer.MAX_VALUERpcQosOptions.getHintMaxNumWorkers()
public RpcQosOptions.Builder withReportDiagnosticMetrics()
If invoked on this builder, 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)
RpcQosOptions.isShouldReportDiagnosticMetrics()
public RpcQosOptions build()
RpcQosOptions
from the current builder state.
All provided values will be validated for non-nullness and that each value falls within its allowed range.
RpcQosOptions
from the current builder state.java.lang.NullPointerException
- if any nullable value is nulljava.lang.IllegalArgumentException
- if any provided value does not fall within its allowed range