1

I'm running a Python Flask endpoint locally and it all works fine, but when I deploy it in GCP AppEngine, I get a 502 Bad Gateway.

It seems to fail at about 200 reads of 2290 bytes each. I've increased the memory_gb of both the default YAML and the endpoint.

1 Answers1

0

It seems that there is a memory leak somewhere in the mix of AppEngine, BigQuery Client, Python, Flask, gunicorn, etc.

I solved it after playing with the gunicorn configuration,

entrypoint: gunicorn -c gunicorn.conf.py -b :$PORT "main:app"

import multiprocessing

backlog = 2048

max_requests = 7
workers = multiprocessing.cpu_count() * 2 + 1
threads = 8
worker_class = 'sync'
worker_connections = 1000
timeout = 30
keepalive = 2