Reading from a non-existent database causes the client to send many BatchCreateSessions RPCs #768
Labels
api: spanner
Issues related to the googleapis/java-spanner API.
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
I noticed that reads to a non-existent database can be very slow to fail. I looked into the issue further and found that the client continues to send BatchCreateSessions RPCs after the read fails, so the additional BatchCreateSessions RPCs may be the cause of the slowness.
google-cloud-spanner: 3.1.2 and HEAD
grpc-java: 1.34.0
Reproducing slow reads
When I ran this test, the reads started out taking about 300 milliseconds. After five minutes, the logging showed that the reads had slowed down to about ten seconds.
Reproducing excessive calls to BatchCreateSessions
I initially noticed the high rate of BatchCreateSessions RPCs in OpenCensus RPC stats. However, I simplified the reproduction to avoid OpenCensus and issue #202 by instead adding a log statement before
java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionClient.java
Line 296 in 90ad9d6
The output seems to show that the client sends one BatchCreateSessions RPC every ten seconds for each failed read:
The text was updated successfully, but these errors were encountered: