title: Improving cold start up times on Google App Engine running Django on Python 3.7 Standard environment
body: <p>I'm running a Django-based web app on Google App Engine under the Python 3.7 Standard Environment. When using the app, requests usually take around 500ms, which is completely acceptable. Howevever, when the app has not been accessed for some time (a few minutes), the logs show that the Google App Engine instance is shut down, and the next request requires gunicorn to load again and takes about 20 second. </p>
  
  <p>I obciously can't have users wait 20 seconds before the page loads. When testing on my local setup, the server takes a few seconds to load environment variables, and then the debug server loads almost immediately.</p>
  
  <p>I don't think there is a problem with my code, given that once the "cold start" occurs, everything is running fast, so it's not like the requests are waiting for a database read or something like that.</p>
  
  <p>What options are there to optimise django cold starts on Google App Engine? </p>
  
  <p>So far, I've increased instance class to F4, and specified the number fo gunicorn workers according to <a href="https://cloud.google.com/appengine/docs/standard/python3/runtime" rel="nofollow noreferrer">this guide</a>. I can in theory go to F4_1G, but that's the highest available instance, and it doesn't seem to address the cold start issue.</p>
  
  <p>The only other thing I can think of that could slow down the instance start up is that in my app.yaml, I have 32 environment variables set up (mostly API credentials). Could this be the main reason for the long start up times? And if so, is there a secure alternative of providing API credentials to Django without using environment variables?</p>
  
  <p>Thank you</p>