parksunwoo / memo-archive

memo of dev issues
0 stars 0 forks source link

nginx 설정 정리 #9

Open parksunwoo opened 3 years ago

parksunwoo commented 3 years ago
parksunwoo commented 3 years ago

AWSKRUG- AWS한국사용자모임 https://www.facebook.com/groups/awskrug/permalink/1929966030438745/?comment_id=1931444116957603

https://github.com/unbit/uwsgi/issues/1804?fbclid=IwAR17bxPikNhUoxkUgKDKlLY4c_OLLRbcxLT8nAxtuoa5mD__ZdLu6l8V6_E

parksunwoo commented 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.

parksunwoo commented 3 years ago

[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

parksunwoo commented 3 years ago

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"

parksunwoo commented 3 years ago

https://github.com/benoitc/gunicorn/blob/master/docs/source/faq.rst#why-are-workers-silently-killed

parksunwoo commented 3 years ago

https://www.datadoghq.com/blog/nginx-502-bad-gateway-errors-gunicorn/

parksunwoo commented 3 years ago

https://dev.to/kokospapa8/gunicorn-performance-analysis-on-aws-ec2-28jl https://github.com/kokospapa8/gunicorn-perf-sample

parksunwoo commented 3 years ago

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 증분)