Skip to content

Commit 9858c4d

Browse files
Merge pull request #1754 from igorbernstein2/pool-size
googlebigtable2: add ability to statically size the channel pool
2 parents 9706b6b + 36696e8 commit 9858c4d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

googlebigtable2/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ The following options can be configured using CLI (using the `-p` parameter).
8585
* `googlebigtable2..max-outstanding-bytes`: (Optional) When batching is enabled, override the limit of number of outstanding mutation bytes.
8686
* `googlebigtable2.reverse-scans`: (Optional) When enabled, scan start keys will be treated as end keys
8787
* `googlebigtable2.timestamp`: (Optional) When set, the timestamp will be used for all mutations, avoiding unbounded growth of cell versions.
88+
* `googlebigtable2.channel-pool-size`: (Optional) When set, disables channel pool autosizing and statically sets the pool size.
8889

8990
## Bigtable client version
9091

googlebigtable2/src/main/java/site/ycsb/db/GoogleBigtable2Client.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.google.api.gax.batching.Batcher;
1919
import com.google.api.gax.batching.BatchingException;
2020
import com.google.api.gax.batching.BatchingSettings;
21+
import com.google.api.gax.grpc.ChannelPoolSettings;
2122
import com.google.cloud.bigtable.data.v2.BigtableDataClient;
2223
import com.google.cloud.bigtable.data.v2.BigtableDataSettings;
2324
import com.google.cloud.bigtable.data.v2.models.Filters;
@@ -31,6 +32,7 @@
3132
import com.google.cloud.bigtable.data.v2.models.RowMutation;
3233
import com.google.cloud.bigtable.data.v2.models.RowMutationEntry;
3334
import com.google.cloud.bigtable.data.v2.models.TableId;
35+
import com.google.cloud.bigtable.data.v2.stub.EnhancedBigtableStubSettings;
3436
import com.google.common.base.Preconditions;
3537
import com.google.common.base.Strings;
3638
import com.google.protobuf.ByteString;
@@ -68,6 +70,8 @@ public class GoogleBigtable2Client extends site.ycsb.DB {
6870
private static final String CLIENT_SIDE_BUFFERING_KEY = PROP_PREFIX + ".use-batching";
6971
private static final String REVERSE_SCANS_KEY = PROP_PREFIX + ".reverse-scans";
7072
private static final String FIXED_TIMESTAMP_KEY = PROP_PREFIX + ".timestamp";
73+
// Defaults to autosized
74+
private static final String CHANNEL_POOL_SIZE = PROP_PREFIX + ".channel-pool-size";
7175

7276
/**
7377
* Print debug information to standard out.
@@ -125,6 +129,15 @@ private static synchronized void globalInit(Properties props) throws IOException
125129

126130
Optional.ofNullable(props.getProperty(APP_PROFILE_ID_KEY)).ifPresent(builder::setAppProfileId);
127131

132+
Optional.ofNullable(props.getProperty(CHANNEL_POOL_SIZE))
133+
.map(Integer::parseInt)
134+
.ifPresent(size ->
135+
builder.stubSettings().setTransportChannelProvider(
136+
EnhancedBigtableStubSettings.defaultGrpcTransportProviderBuilder()
137+
.setChannelPoolSettings(ChannelPoolSettings.staticallySized(size))
138+
.build()
139+
));
140+
128141
columnFamily = getRequiredProp(props, FAMILY_KEY);
129142

130143
// Endpoint

0 commit comments

Comments
 (0)