@BetaApi(value="The surface for batching is not stable yet and may change in the future.") public abstract class BatchingSettings extends Object
Each batching client must define their own set of default values for these thresholds, which would be the safest behavior for their jobs.
The default instance of this settings does not have any default values. Users are expected to configure batching thresholds explicitly: the element count or the request bytes count. Thresholds can be disabled(meaning immediate result of input elements) by setting its value to 0.
Warning: With the incorrect settings, it is possible to cause long periods of dead waiting time.
When batching is configured for an API method, a call to that method will result in the request being queued up with other requests. When any of the set thresholds are reached, the queued up requests are packaged together in a batch and set to the service as a single RPC. When the response comes back, it is split apart into individual responses according to the individual input requests.
There are several supported thresholds:
These thresholds are treated as triggers, not as limits. Each threshold is an independent trigger and doesn't have any knowledge of the other thresholds.
| Modifier and Type | Class and Description |
|---|---|
static class |
BatchingSettings.Builder
See the class documentation of
BatchingSettings for a description of the different
values that can be set. |
| Constructor and Description |
|---|
BatchingSettings() |
| Modifier and Type | Method and Description |
|---|---|
abstract int |
getElementCountThreshold()
Get the element count threshold to use for batching.
|
abstract long |
getRequestByteThreshold()
Get the request byte threshold to use for batching.
|
static BatchingSettings.Builder |
newBuilder()
Get a new builder.
|
abstract BatchingSettings.Builder |
toBuilder()
Get a builder with the same values as this object.
|
public abstract int getElementCountThreshold()
public abstract long getRequestByteThreshold()
public static BatchingSettings.Builder newBuilder()
public abstract BatchingSettings.Builder toBuilder()