Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Google appengine standard produces huge number of instances on deployment

We are using Google appengine standard with Java 8 with Cloud sql. We have been facing big problems on deployment a new version, where Google creates a huge amount of instances which causes that we ready the max number of database connections. We do not understand why this big number of instances is created although the number of active instances in the previous version is small in comparison.

We are using auto scaling, and have the warmup requests enabled, and our deploy command is as below:

mvn package appengine:deploy  -Dapp.deploy.version=v0-0-1-9a5f1d5d754726614a1e61db1d18037bd744f16e

Can someone please explain why this behavior happens and how can we prevent it ?

 

Bassem_0-1682239291810.png

 

 

 

0 1 159
1 REPLY 1

 

Good Day, Bassem!

Welcome to Google Cloud Community!

You can refer to this documentation

This incident is normal since the spikes in traffic might cause elevated latency in cases where an auto-scaled application needs to scale up more quickly than is possible without affecting latency.

This helps you to optimize code on App Engine to reduce latency:

  • Offline work: Use Cloud Tasks so that user requests do not block waiting for completion of work such as sending mail.

  • Asynchronous API calls: Ensure that your code is not blocked waiting for an API call to complete. Libraries such as ndb offer built-in support for this.
  • Batch API calls: The batch version of API calls is usually faster than sending individual calls.
  • Denormalize data models: Reduce the latency of calls made to the data persistence layer by denormalizing your data models.

 

Hope this helps.