Reputation: 2002
Is there any built-in library exists or is it required to implement custom one?
I have tried to check here, but not sure how to ahead from here: Bigtable connection pool
I have tried the below code, but not really sure how to progress from here:
import com.google.cloud.bigtable.config.BigtableOptions;
import com.google.cloud.bigtable.config.CredentialOptions;
import com.google.cloud.bigtable.grpc.BigtableSession;
import com.google.cloud.bigtable.grpc.io.ChannelPool;
import com.mahindra.digisense.config.AppConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.GeneralSecurityException;
@Component
public class BigTableConnectionPoolingExample {
@Autowired
private AppConfig.BigTableConfig bigTableConfig;
private void bigTableConnectionPooling() throws IOException, GeneralSecurityException {
CredentialOptions credentialOptions = CredentialOptions.jsonCredentials(new FileInputStream(new File(bigTableConfig.getCredentialsJson())));
BigtableOptions.Builder builder = new BigtableOptions.Builder();
builder.setCredentialOptions(credentialOptions);
ChannelPool.ChannelFactory channelFactory = (ChannelPool.ChannelFactory) BigtableSession.createChannelPool(bigTableConfig.getInstanceId(), builder.build());
ChannelPool channelPool = new ChannelPool(channelFactory,3);
}
}
Here is another Stack Overflow question, which has no answers.
Upvotes: 1
Views: 1696
Reputation: 895
As noted by Solomon Duskis, we are encouraging new folks to get started with the idiomatic Bigtable client in google-cloud-java. The client is suitable for production use, however we have not finalized the client API so we may make backward-incompatible changes.
If you are using the HBase client from the Cloud Bigtable Client repo, there are options to adjust the number of data channels used underneath as well as the number of inflight RPCs per channel. But we suggest that you profile your application first, as you should be able to achieve good performance and saturate your clusters without needing to manually adjust these parameters from their defaults.
Upvotes: 1