0

Is there a maximum number of DatabaseClient that can be created for an instance of Google Cloud Spanner?

Will the number of DatabaseClient affect to the performance?

nisarg parekh
  • 413
  • 4
  • 23

1 Answers1

2

DatabaseClients are cached, so for identical database ids Spanner#getDatabaseClient returns the same instance of DatabaseClient.

Internally DatabaseClient opens multiple gRPC channels and maintains the session pool. This is something that can be configured with SpannerOptions#setNumChannels and SpannerOptions#setSessionPoolOptions.

The default number of open channels is optimized for low latency requests and works well in most cases. If you are sending high latency requests increasing number of channels potentially can lead to better throughput.

Mairbek Khadikov
  • 7,939
  • 3
  • 35
  • 51
  • Actually, i never touch the SpannerOptions. I just follow the simple tutorial written on Spanner documentaion. Well, I will give it a try, and let you know how it goes. thanks anyway ! Sorry for late reply. – Miftah Fathudin Jul 03 '17 at 17:32