Skip to content

Commit

Permalink
feat: enable batch write flow control (#4077)
Browse files Browse the repository at this point in the history
  • Loading branch information
mutianf authored Jun 6, 2023
1 parent 3f602ab commit 4f7f79c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -314,4 +314,14 @@ public class BigtableOptionsFactory {
@BetaApi("This API is not yet stable and may change in the future")
public static final String MANAGED_CONNECTION_WARNING =
"google.bigtable.managed.connection.warning";

/**
* Option to enable flow control. When enabled, traffic to Bigtable is automatically rate-limited
* based on the current Bigtable usage to prevent overloading Bigtable clusters while keeping
* enough load to trigger Bigtable Autoscaling (if enabled) to provision more nodes as needed. It
* is different from the flow control set by {@link #BIGTABLE_BUFFERED_MUTATOR_ENABLE_THROTTLING},
* which limits the number of outstanding requests to Bigtable.
*/
public static final String BIGTABLE_ENABLE_BULK_MUTATION_FLOW_CONTROL =
"google.bigtable.enable.bulk.mutation.flow.control";
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import static com.google.cloud.bigtable.hbase.BigtableOptionsFactory.BIGTABLE_BULK_THROTTLE_TARGET_MS_DEFAULT;
import static com.google.cloud.bigtable.hbase.BigtableOptionsFactory.BIGTABLE_DATA_CHANNEL_COUNT_KEY;
import static com.google.cloud.bigtable.hbase.BigtableOptionsFactory.BIGTABLE_EMULATOR_HOST_KEY;
import static com.google.cloud.bigtable.hbase.BigtableOptionsFactory.BIGTABLE_ENABLE_BULK_MUTATION_FLOW_CONTROL;
import static com.google.cloud.bigtable.hbase.BigtableOptionsFactory.BIGTABLE_HOST_KEY;
import static com.google.cloud.bigtable.hbase.BigtableOptionsFactory.BIGTABLE_MUTATE_RPC_ATTEMPT_TIMEOUT_MS_KEY;
import static com.google.cloud.bigtable.hbase.BigtableOptionsFactory.BIGTABLE_MUTATE_RPC_TIMEOUT_MS_KEY;
Expand Down Expand Up @@ -640,6 +641,9 @@ private void configureBulkMutationSettings(

builder.enableLatencyBasedThrottling(latencyMs);
}

builder.setServerInitiatedFlowControl(
configuration.getBoolean(BIGTABLE_ENABLE_BULK_MUTATION_FLOW_CONTROL, false));
}

private void configureBulkReadRowsSettings(
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ limitations under the License.
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- core dependency versions -->
<bigtable.version>2.20.3</bigtable.version>
<bigtable.version>2.22.0</bigtable.version>
<google-cloud-bigtable-emulator.version>0.157.3</google-cloud-bigtable-emulator.version>
<bigtable-client-core.version>1.28.0</bigtable-client-core.version>
<grpc-conscrypt.version>2.5.2</grpc-conscrypt.version>
Expand Down

0 comments on commit 4f7f79c

Please sign in to comment.