Open parksunwoo opened 3 years ago
502 Bad Gateway https://docs.aws.amazon.com/ko_kr/elasticloadbalancing/latest/application/load-balancer-troubleshooting.html#http-502-issues
504 Gateway Time-out nginx/1.19.10
Gunicorn sync workers time out on docker + AWS #1194 https://github.com/benoitc/gunicorn/issues/1194
-> This new application runs without problems on gunicorn when using gevent workers.
[2021-05-18 02:15:22 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:2173) [2021-05-18 02:15:22 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:2174) [2021-05-18 02:15:23 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:2175) [2021-05-18 11:15:23 +0900] [2173] [INFO] Worker exiting (pid: 2173) [2021-05-18 11:15:23 +0900] [2174] [INFO] Worker exiting (pid: 2174) [2021-05-18 11:15:23 +0900] [2175] [INFO] Worker exiting (pid: 2175)
timeout 이 30초 이후 발생해서 gunicorn timeout 옵션도 300 으로 지정
gunicorn app.wsgi:application --bind 0.0.0.0:8000 --worker-class gevent --workers 3 --timeout 300
2021/05/18 04:28:04 [error] 21#21: *993 connect() failed (110: Connection timed out) while connecting to upstream, client: site A, server: , request: "GET / HTTP/1.1", upstream: "site B:8000/", host: "test.elasticbeanstalk.com"
https://docs.aws.amazon.com/ko_kr/AmazonECS/latest/developerguide/create-task-definition.html
Task size(작업 크기)에서 Task memory (GB)(작업 메모리(GB)) 값과 Task CPU (vCPU)(작업 CPU(vCPU)) 값을 선택으로 해결
CPU 값 | 메모리 값 |
---|---|
256(.25 vCPU) | 512MB, 1GB, 2GB |
512(.5 vCPU) | 1GB, 2GB, 3GB, 4GB |
1024(1 vCPU) | 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB |
2048(2 vCPU) | 4~16GB(1GB 증분) |
4096(4 vCPU) | 8~30GB(1GB 증분) |
환경 : Elastic Beanstalk, docker django nginx gunicorn
에러메시지 upstream prematurely closed connection while reading response header from upstream client: siteA, server: , request: "GET /admin/pages/321/edit/ HTTP/1.1", upstream: "siteB/admin/pages/321/edit/", host: "x.elasticbeanstalk.com", referrer: "x.elasticbeanstalk.com/admin/"
참고
[Nginx] 엔진엑스 프록시 모듈 https://12bme.tistory.com/367