We are using Google App Engine automatic scaling for quite some time now and I always wondered about the memory usage that it has. We have a Flask app that is 56 MB big on a local machine (before deploying). On a local machine in virtual environment the app is using around 40 MB of memory.
After deploying the app to Google Cloud (even though we set the gcloudignore file so that venv and local database are not deployed), the size of the container in Artifact Registry is 534 MB. This is one thing that I don’t understand, why the container is so much bigger than the actual app. I’m suspecting because a container has other stuff inside it like OS and supporting plugins to run the app?
Then the next interesting thing is that when you look at the memory usage, it’s constantly using at least 1.56 GB of memory per 1 instance (one instance has 1.6GB of memory).
Constant memory usage of 1.56 GB
This seems way too much memory usage for a simple Flask app. Here is the app.yaml, we have to use the F4_1G instance class, otherwise the app does not have enough memory (500 Internal Server error and in the logs it states that the system ran out of memory).
app.yaml file
I’m kind of new to Google Cloud so any help would be appreciated.
I expected the memory usage and container image would be a lot smaller (the billing is expensive for instance class F4_1G). If usage would be less, then we could lower the instance class and have cheaper billing.
Jan Verderber is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.