I am trying to convert my Django/Python app from the Google App Engine Standard Environment to the Flexible environment mainly due to the app becoming slow and was constantly hitting a soft memory limit and suggested I upgrade to a larger instance class. I was already at the highest instance class. My problem is when I try to deploy the build is successful but I keep getting an error when Updating service.
"Your deployment has failed to become healthy in the allotted time and therefore was rolled back. If you believe this was an error, try adjusting the 'app_start_timeout_sec' setting in the 'readiness_check' section."
I've tried adjusting the readiness_check section to allow more time but it just takes longer to give me the same error it seems.I've tried googling this issue and adding more memory but the same error still shows. I'm stuck at this point and I'm not sure where else to look.
Here is the app.yaml that successfully deployed on the standard environment
entrypoint: gunicorn -b :$PORT xpotools.wsgi
instance_class : F4_1G
automatic_scaling:
min_instances: 5
min_pending_latency: 30ms
max_pending_latency: 4s
max_concurrent_requests: 20
min_idle_instances: 3
inbound_services:
- warmup
handlers:
- url: /static
static_dir: static/
secure: always
- url: /.*
script: auto
secure: always
- url: /_ah/warmup
script: auto
Here is the app.yaml that I'm trying to deploy to the flexible environment
env: flex
runtime_config:
python_version: 3.7
resources:
cpu: 1
memory_gb: 6
disk_size_gb: 20
entrypoint: gunicorn -b :$PORT xpotools.wsgi
Am I missing something?
Log from gcloud app deploy --versbosity=debug
CodePudding user response:
You said that your app was exceeding the GAE standard memory.
At what point does your app start using a lot of memory? If your app starts consuming a lot of memory immediately at deployment (even before an HTTP request is received) then that could be the issue.
I don't fully understand the issue, but GAE flex spins up a lot of workers at deployment, and I suspect each of these workers takes up a significant amount of memory, and combined they exceed your memory limits.
Try updating your app so that memory is consumed at a later time, such as after receiving a first HTTP request. That fixed a similar issue for me.