I am using the Spanner client library for Java and i configure the client using Spring (Java 10 and Docker)
After a while, the application start to log the following message but i don't understand why. The application concurrency is minimal. It's seem the sessions aren't reused.
I monitor the session with Stackdriver and they are below 20.
If i remove setFailIfPoolExhausted the applicacion hang instead of throwing exception RESOURCE_EXHAUSTED.
RESOURCE_EXHAUSTED: No session available in the pool. Maximum number of sessions in the pool can be overridden by invoking SessionPoolOptions#Builder#setMaxSessions. Client can be made to block rather than fail by setting SessionPoolOptions#Builder#setBlockIfPoolExhausted.
@ConfigurationpublicclassSpannerConfig {
@Value("${datasource.instanceId}")
privateStringinstance;
@Value("${datasource.databaseId}")
privateStringdatabase;
@BeanpublicSpannerspannerService() throwsIOException {
SessionPoolOptionssessionPoolOptions = SessionPoolOptions.newBuilder()
.setFailIfPoolExhausted()
.setMinSessions(5)
.setMaxSessions(100)
.build();
SpannerOptionsoptions = SpannerOptions.newBuilder()
.setSessionPoolOption(sessionPoolOptions)
.build();
returnoptions.getService();
}
@BeanpublicDatabaseClientspannerClient(SpannerspannerService) {
DatabaseIddatabaseId = DatabaseId.of(spannerService.getOptions().getProjectId(), instance, database);
returnspannerService.getDatabaseClient(databaseId);
}
}
I am using the Spanner client library for Java and i configure the client using Spring (Java 10 and Docker)
After a while, the application start to log the following message but i don't understand why. The application concurrency is minimal. It's seem the sessions aren't reused.
I monitor the session with Stackdriver and they are below 20.
If i remove setFailIfPoolExhausted the applicacion hang instead of throwing exception RESOURCE_EXHAUSTED.