출처: https://wasking.tistory.com/92
■ 현상
was의 어플리케이션에서 아래와 같은 로그 발생
OutOfMemoryError : unable to create new native thread
■ 원인
/etc/security/limit.conf 에서 nproc의 값(4096)으로 인해 프로세스 생성 제한이 되어버림.
조치 후 was계정에서 생성한 프로세스의 개수(4961)
■ 조치사항
/etc/security/limit.conf 에서 was계정에 대해 아래와 같이 설정
testuser soft nofile 65535
testuser hard nofile 65535
testuser soft nproc 65535
testuser hard nproc 65535
□ ulimit과 /etc/security/limit.conf 에 대한 설명
리눅스는 /etc/security/limit.conf 파일을 통해 서버의 리소스를 관리함
ulimit는 프로세스의 자원 한도를 설정 및 확인하는 명령(limit.conf)에서 읽어온다. soft / hard 두가지 제한으로 나뉨
soft : 새로운 프로그램을 생성하면 기본으로 적용되는 한도
hard : 최대로 늘릴 수 있는 한도
# ulimit -a // Soft 설정 보기
# ulimit -aH // Hard 설정 보기
통상적으로 soft와 hard를 1:1로 맞추어 설정
limit.conf의 내용은 주로 아래와 같이 구성
testuser soft nofile 65535
testuser hard nofile 65535
testuser soft nproc 65535
testuser hard nproc 65535
nproc (number of processes) : 프로세스 최대 개수
nofile (number of open files) : 파일 열기 최대 개수
리눅스에서는 모든 개체를 파일로 보기에 nproc를 높이면 nofile도 같이 높여주는 것이 맞다.
● 계정당 생성한 프로세스 개수
# ps h -Led -o user | sort | uniq -c | sort -n
● 계정의 오픈한 파일 개수
# lsof -u [username] | wc -l
# sysctl -a |grep file-nr
'컴퓨터 활용(한글, 오피스 등) > 50_2.운영체제_리눅스' 카테고리의 다른 글
리눅스_우분투_설치 후 기본설정 (0) | 2022.11.14 |
---|---|
리눅스_특수기호 (0) | 2022.11.14 |
리눅스 -"'kr.archive.ubuntu.com'의 주소를 알아낼 수 없습니다" 에러 해결 방법.(linux ubuntu v18.04) (0) | 2022.11.14 |
리눅스_우분투 미러 사이트 변경 (0) | 2022.11.14 |
리눅스_OPENSTACK_KVM (0) | 2022.11.14 |