20% of requests to our backend Django application (deployed on AWS using ECS and Postgres RDS) are throwing 500 errors. Looking at the ECS logs, various related errors are shown:
psycopg2.OperationalError: could not translate host name "abc.efg.us-east-1.rds.amazonaws.com" to address
OSError: [Errno 16] Device or resource busy
<built-in function getaddrinfo>) failed with OSError
We use gunicorn and gevent to serve our app:
gunicorn -t 1000 -k gevent -w 4 -b 0.0.0.0:8000 backend.wsgi