-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
Description
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.
@Configuration
public class SpannerConfig {
@Value("${datasource.instanceId}")
private String instance;
@Value("${datasource.databaseId}")
private String database;
@Bean
public Spanner spannerService() throws IOException {
SessionPoolOptions sessionPoolOptions = SessionPoolOptions.newBuilder()
.setFailIfPoolExhausted()
.setMinSessions(5)
.setMaxSessions(100)
.build();
SpannerOptions options = SpannerOptions.newBuilder()
.setSessionPoolOption(sessionPoolOptions)
.build();
return options.getService();
}
@Bean
public DatabaseClient spannerClient(Spanner spannerService) {
DatabaseId databaseId = DatabaseId.of(spannerService.getOptions().getProjectId(), instance, database);
return spannerService.getDatabaseClient(databaseId);
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.