Sign In

Node.js

--max-old-space-size 옵션 관련
node.js의 —max-old-space-size 기본 값 확인 $ node > v8.getHeapStatistics() { total_heap_size: 6578176, total_heap_size_executable: 262144, total_physical_size: 6815744, total_available_size: 2193448312, used_heap_size: 5277544, heap_size_limit: 2197815296, malloced_memory: 163968, peak_malloced_memory: 172528, does_zap_garbage: 0, number_of_native_contexts: 2, number_of_detached_contexts: 0, total_global_handles_size: 8192, used_global_handles_size: 3040, external_memory: 2269138 } 기본값이 2GB인 것으로 확인함. 참고: https://stackoverflow.com/questions/48387040/how-do-i-determine-the-correct-max-old-space-size-for-node-js 수정 node.js 공식문서의 추천에 따르면, 서버 메모리 2GB 당 1536MB로 설정하라고 한다. pm2의 ecosystem 파일에 옵션을 추가하기위해, 파일을 아래와 같이 변경. { ... node_args: '--max-old-space-size=1536', ... }
  • 1more
PM2 필요했던 명령어들
환경변수 수정 후, 수정된 변수로 pm2를 다시 띄움 적용된 환경변수 목록 조회 restart 카운트 초기화 pm2 프로세스를 죽였다 살리기(app 상태 유지)
  • 1more
AWS Opensearch Service에 bulk 작업에 timeout이 발생한다.....
Opensearch에 bulk요청을 할 때, timeout이 발생한다. 왜인지 알수 없어 주위에 물어보니, 보통 커넥터에 요청 데이터의 크기 제한이 있고(ES 클라이언트에선 http.max_content_length 옵션으로 설정하나보다), 그것보다 큰 데이터 요청을 보내면 타임아웃이 날 때가 있다고 한다. opensearch는 어떻게 되는지 찾아보니, 인스턴스 타입별 미리 정해진 네트워크 용량 제한이 있다고 한다. 지독한놈들.. es index작업이나 bulk에서 이유모를 timeout이 발생한다면, 사용중인 instance의 타입과 타입별 용량제한을 확인해보자.
  • 1more
Made with Slashpage