|
18 | 18 | import com.google.api.gax.batching.Batcher; |
19 | 19 | import com.google.api.gax.batching.BatchingException; |
20 | 20 | import com.google.api.gax.batching.BatchingSettings; |
| 21 | +import com.google.api.gax.grpc.ChannelPoolSettings; |
21 | 22 | import com.google.cloud.bigtable.data.v2.BigtableDataClient; |
22 | 23 | import com.google.cloud.bigtable.data.v2.BigtableDataSettings; |
23 | 24 | import com.google.cloud.bigtable.data.v2.models.Filters; |
|
31 | 32 | import com.google.cloud.bigtable.data.v2.models.RowMutation; |
32 | 33 | import com.google.cloud.bigtable.data.v2.models.RowMutationEntry; |
33 | 34 | import com.google.cloud.bigtable.data.v2.models.TableId; |
| 35 | +import com.google.cloud.bigtable.data.v2.stub.EnhancedBigtableStubSettings; |
34 | 36 | import com.google.common.base.Preconditions; |
35 | 37 | import com.google.common.base.Strings; |
36 | 38 | import com.google.protobuf.ByteString; |
@@ -68,6 +70,8 @@ public class GoogleBigtable2Client extends site.ycsb.DB { |
68 | 70 | private static final String CLIENT_SIDE_BUFFERING_KEY = PROP_PREFIX + ".use-batching"; |
69 | 71 | private static final String REVERSE_SCANS_KEY = PROP_PREFIX + ".reverse-scans"; |
70 | 72 | 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"; |
71 | 75 |
|
72 | 76 | /** |
73 | 77 | * Print debug information to standard out. |
@@ -125,6 +129,15 @@ private static synchronized void globalInit(Properties props) throws IOException |
125 | 129 |
|
126 | 130 | Optional.ofNullable(props.getProperty(APP_PROFILE_ID_KEY)).ifPresent(builder::setAppProfileId); |
127 | 131 |
|
| 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 | + |
128 | 141 | columnFamily = getRequiredProp(props, FAMILY_KEY); |
129 | 142 |
|
130 | 143 | // Endpoint |
|
0 commit comments