EMR 마스터노드의 버퍼&캐시 메모리 관리이슈 해결하기

2021-08-27

.

Data_Engineering_TIL(202108127)

[학습내용]

  • 문제현상

Permanent하게 EMR을 운영할때 메모리 관리를 별도로 해주지 않으면 마스터 메모리의 사용량이 누적되어 free 메모리의 비율이 5% 이하로 줄어들게 된다.

# 숫자의 단위는 KB임
$ free -m
        total       used       free         shared      buff/cache       avaliable
Mem :   127462      26005      20596        9           80860            100291
Swap:   0           0          0
  • 해결방안

아래 명령어를 이용해서 airflow나 크론탭을 통해 주기적으로 버퍼/캐시 메모리를 정리해주면 된다.

STEP 1) 자주사용하는 하둡 어플리케이션 리스타트

STEP 2) 캐비/버퍼 메모리 삭제

$ sudo docker restart jupyterhub

$ sudo systemctl restart hadoop-yarn-resourcemanager

$ sudo systemctl restart livy-server

$ sudo systemctl restart hadoop-hdfs-namenode

$ sync; echo 1 | sudo tee /proc/sys/vm/drop_caches
1

$ free -m
        total       used       free         shared      buff/cache       avaliable
Mem :   127462      25998      99306        9           2156             100298
Swap:   0           0          0