Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
20e012d
feat/idle-channel-eviction
nicholsl Aug 1, 2025
d2b6129
create noop channel primer
nicholsl Aug 27, 2025
333e9e9
no-op channel primer changes
nicholsl Aug 27, 2025
4ddefce
update ignored diffs
nicholsl Aug 27, 2025
ba9e039
chore: Update generation configuration at Thu Aug 7 02:49:23 UTC 202…
cloud-java-bot Aug 7, 2025
3646452
deps: update shared dependencies (#2654)
mutianf Aug 8, 2025
b741869
chore(main): release 2.64.0 (#2652)
release-please[bot] Aug 8, 2025
bafedf9
feat(bigtable): lower the value for max rpc channels as channel resiz…
sushanb Aug 11, 2025
cbdb4e2
chore(main): release 2.64.1-SNAPSHOT (#2655)
release-please[bot] Aug 12, 2025
0422092
chore(main): release 2.65.0 (#2657)
release-please[bot] Aug 12, 2025
171ac40
chore(main): release 2.65.1-SNAPSHOT (#2658)
release-please[bot] Aug 13, 2025
5b619b1
Merge branch 'googleapis:main' into feat/idle-channel-eviction
nicholsl Aug 27, 2025
862135b
more noop channel primer changes
nicholsl Aug 27, 2025
c0082cf
remove outdated comments
nicholsl Aug 27, 2025
7a007bf
cleanup
nicholsl Aug 27, 2025
beda46e
pr feedback
nicholsl Aug 28, 2025
dff1361
Merge branch 'googleapis:main' into feat/idle-channel-eviction
nicholsl Aug 28, 2025
e6cab0c
fix: lint
nicholsl Sep 2, 2025
c77e876
fix: pr feedback
nicholsl Sep 4, 2025
98fe29b
fix: feedback
nicholsl Sep 9, 2025
69aeeef
fix: lint
nicholsl Sep 9, 2025
52e1cb7
Merge branch 'googleapis:main' into feat/idle-channel-eviction
nicholsl Sep 9, 2025
32a7ac0
move history pruning
nicholsl Sep 9, 2025
580d5de
fix: nits
nicholsl Sep 9, 2025
111582c
Apply suggestion from @mutianf
nicholsl Sep 10, 2025
6df0856
Apply suggestion from @mutianf
nicholsl Sep 10, 2025
b86d7c5
Merge branch 'googleapis:main' into feat/idle-channel-eviction
nicholsl Sep 10, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions google-cloud-bigtable/clirr-ignored-differences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -426,4 +426,34 @@
<method>*create*</method>
<to>*</to>
</difference>
<difference>
<differenceType>4001</differenceType>
<className>com/google/cloud/bigtable/data/v2/stub/BigtableChannelPrimer</className>
<to>com/google/api/gax/grpc/ChannelPrimer</to>
</difference>
<difference>
<differenceType>4001</differenceType>
<className>com/google/cloud/bigtable/data/v2/stub/NoOpChannelPrimer</className>
<to>com/google/api/gax/grpc/ChannelPrimer</to>
</difference>
<difference>
<differenceType>7005</differenceType>
<className>com/google/cloud/bigtable/gaxx/grpc/BigtableChannelPool</className>
<method>*create*</method>
<to>*</to>
</difference>
<difference>
<!-- InternalApi was updated -->
<differenceType>7005</differenceType>
<className>com/google/cloud/bigtable/gaxx/grpc/BigtableTransportChannelProvider</className>
<method>*create*</method>
<to>*</to>
</difference>
<!-- change method return type is ok because BigtableChannelPrimer is InternalApi -->
<difference>
<differenceType>7006</differenceType>
<className>com/google/cloud/bigtable/data/v2/stub/BigtableChannelPrimer</className>
<method>*sendPrimeRequestsAsync*</method>
<to>com.google.api.core.ApiFuture</to>
</difference>
</differences>
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
*/
package com.google.cloud.bigtable.data.v2.stub;

import com.google.api.core.ApiFuture;
import com.google.api.core.InternalApi;
import com.google.api.core.SettableApiFuture;
import com.google.api.gax.grpc.ChannelPrimer;
import com.google.auth.Credentials;
import com.google.bigtable.v2.BigtableGrpc;
import com.google.bigtable.v2.InstanceName;
import com.google.bigtable.v2.PingAndWarmRequest;
import com.google.bigtable.v2.PingAndWarmResponse;
import com.google.cloud.bigtable.gaxx.grpc.ChannelPrimer;
import io.grpc.CallCredentials;
import io.grpc.CallOptions;
import io.grpc.ClientCall;
Expand Down Expand Up @@ -110,8 +111,7 @@ private void sendPrimeRequestsBlocking(ManagedChannel managedChannel) {
}
}

public SettableApiFuture<PingAndWarmResponse> sendPrimeRequestsAsync(
ManagedChannel managedChannel) {
public ApiFuture<PingAndWarmResponse> sendPrimeRequestsAsync(ManagedChannel managedChannel) {
ClientCall<PingAndWarmRequest, PingAndWarmResponse> clientCall =
managedChannel.newCall(
BigtableGrpc.getPingAndWarmMethod(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.CredentialsProvider;
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.api.gax.grpc.ChannelPrimer;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.auth.Credentials;
Expand All @@ -34,6 +33,7 @@
import com.google.cloud.bigtable.data.v2.stub.metrics.MetricsProvider;
import com.google.cloud.bigtable.data.v2.stub.metrics.NoopMetricsProvider;
import com.google.cloud.bigtable.gaxx.grpc.BigtableTransportChannelProvider;
import com.google.cloud.bigtable.gaxx.grpc.ChannelPrimer;
import io.grpc.ManagedChannelBuilder;
import io.grpc.opentelemetry.GrpcOpenTelemetry;
import io.opentelemetry.api.OpenTelemetry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
*/
package com.google.cloud.bigtable.data.v2.stub;

import com.google.api.core.ApiFuture;
import com.google.api.core.InternalApi;
import com.google.api.gax.grpc.ChannelPrimer;
import com.google.api.core.SettableApiFuture;
import com.google.bigtable.v2.PingAndWarmResponse;
import com.google.cloud.bigtable.gaxx.grpc.ChannelPrimer;
import io.grpc.ManagedChannel;

@InternalApi
Expand All @@ -28,7 +31,14 @@ static NoOpChannelPrimer create() {
private NoOpChannelPrimer() {}

@Override
public void primeChannel(ManagedChannel managedChannel) {
public void primeChannel(ManagedChannel channel) {
// No op
}

@Override
public ApiFuture<PingAndWarmResponse> sendPrimeRequestsAsync(ManagedChannel channel) {
SettableApiFuture future = SettableApiFuture.create();
future.set(PingAndWarmResponse.getDefaultInstance());
return future;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import com.google.api.core.InternalApi;
import com.google.api.gax.grpc.ChannelFactory;
import com.google.api.gax.grpc.ChannelPrimer;
import com.google.cloud.bigtable.gaxx.grpc.ChannelPoolHealthChecker.ProbeResult;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
Expand All @@ -31,9 +31,11 @@
import io.grpc.MethodDescriptor;
import io.grpc.Status;
import java.io.IOException;
import java.time.Clock;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -64,9 +66,9 @@ public class BigtableChannelPool extends ManagedChannel {

private final ChannelPrimer channelPrimer;
private final ScheduledExecutorService executor;

private final Object entryWriteLock = new Object();
@VisibleForTesting final AtomicReference<ImmutableList<Entry>> entries = new AtomicReference<>();
private final ChannelPoolHealthChecker channelPoolHealthChecker;
private final AtomicInteger indexTicker = new AtomicInteger();
private final String authority;

Expand Down Expand Up @@ -96,6 +98,10 @@ public static BigtableChannelPool create(
this.settings = settings;
this.channelFactory = channelFactory;
this.channelPrimer = channelPrimer;
Clock systemClock = Clock.systemUTC();
this.channelPoolHealthChecker =
new ChannelPoolHealthChecker(entries::get, channelPrimer, executor, systemClock);
this.channelPoolHealthChecker.start();

ImmutableList.Builder<Entry> initialListBuilder = ImmutableList.builder();

Expand Down Expand Up @@ -445,15 +451,32 @@ static class Entry {

private final AtomicInteger maxOutstanding = new AtomicInteger();

// Flag that the channel should be closed once all of the outstanding RPC complete.
/** Queue storing the last 5 minutes of probe results */
@VisibleForTesting
final ConcurrentLinkedQueue<ProbeResult> probeHistory = new ConcurrentLinkedQueue<>();

/**
* Keep both # of failed and # of successful probes so that we don't have to check size() on the
* ConcurrentLinkedQueue all the time
*/
final AtomicInteger failedProbesInWindow = new AtomicInteger();

final AtomicInteger successfulProbesInWindow = new AtomicInteger();

// Flag that the channel should be closed once all the outstanding RPCs complete.
private final AtomicBoolean shutdownRequested = new AtomicBoolean();
// Flag that the channel has been closed.
private final AtomicBoolean shutdownInitiated = new AtomicBoolean();

private Entry(ManagedChannel channel) {
@VisibleForTesting
Entry(ManagedChannel channel) {
this.channel = channel;
}

ManagedChannel getManagedChannel() {
return this.channel;
}

int getAndResetMaxOutstanding() {
return maxOutstanding.getAndSet(outstandingRpcs.get());
}
Expand All @@ -468,7 +491,7 @@ private boolean retain() {
// register desire to start RPC
int currentOutstanding = outstandingRpcs.incrementAndGet();

// Rough book keeping
// Rough bookkeeping
int prevMax = maxOutstanding.get();
if (currentOutstanding > prevMax) {
maxOutstanding.incrementAndGet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import com.google.api.core.InternalApi;
import com.google.api.gax.grpc.ChannelFactory;
import com.google.api.gax.grpc.ChannelPoolSettings;
import com.google.api.gax.grpc.ChannelPrimer;
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.rpc.TransportChannel;
Expand Down
Loading
Loading