2
votes

I am using Google Cloud SQL using machine type of db-f1-micro for a project deployed on Google App Engine in Standard Environment(JAVA). Sometimes, I got below error while connecting with database. This scenario happens when open same page in multiple tabs at the same time(load/performance testing).

Source code used in project from https://github.com/GoogleCloudPlatform/appengine-cloudsql-native-mysql-hibernate-jpa-demo-java

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method)

The metrics from app engine log for error and mysql usage. You can easily see that mysql active connection usage is below 100%.

enter image description here

enter image description here

Please suggest what wrong I am doing?

2

2 Answers

0
votes

From https://cloud.google.com/appengine/docs/standard/java/cloud-sql/pricing-access-limits

"Each App Engine instance cannot have more than 12 concurrent connections to a Google Cloud SQL instance."

How many requests are sending to App Engine and how many connections does the app instance open for each of those requests ?

0
votes

Looks like this thread is old but we have this problem in our test environment. It happens frequently and repeatedly after our GAE test system is not used for a while. The first time someone tries to access the app we get one or two of these.

I assume it has something to do with GAE ramping up a server instance. Although I'm not sure why this happens with the db. I don't think we have any connection pooling (specifically because GAE can make our app go dormant).

And with the app just starting up, we can't be exceeding any connection limits.