kgneng2 / blokg

blog
MIT License
0 stars 0 forks source link

nginx socket 수 제한으로 인한 error read econnreset syscall read 발생 #37

Open kgneng2 opened 3 years ago

kgneng2 commented 3 years ago
{
  "name": "RequestError",
  "message": "Error: read ECONNRESET",
  "cause": {
    "errno": "ECONNRESET",
    "code": "ECONNRESET",
    "syscall": "read"
  },
  "error": {
    "errno": "ECONNRESET",
    "code": "ECONNRESET",
    "syscall": "read"
  },
  "options": {
    "url": "",
    "method": "GET",
    "json": true,
    "simple": true,
    "resolveWithFullResponse": false,
    "transform2xxOnly": false
  }
}

read ECONNRESET 은 과도한 요청으로 인해 서버와 맺고 있는 connection 수가 부족해서 발생하는 문제이다

해결방법은

server 측에서 connection 수를 증가 시키고 keep-alive 설정 및 connection timeout 설정을 지정한다. 서버 인스턴스를 늘리는것도 방법이 될수있다.

client에서 발송양을 스케줄링해서 connection 수 안팎으로 요청을 해서 진행한다.

해당이슈는 nginx를 붙이면서 발생헀던 이슈로

nginx 설정값 지정을 진행함으로써 해결하였다

-https://kwonnam.pe.kr/wiki/nginx/performance -https://m.blog.naver.com/PostView.nhn?blogId=yprima&logNo=220199335325&proxyReferer=https:%2F%2Fwww.google.com%2F