728x90

■ 현상
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

728x90

'IT > OS (Unix Linux Windows)' 카테고리의 다른 글

[링크]공유메모리 삭제  (0) 2021.09.27
[LINUX]TIME_WAIT  (0) 2021.09.17
[Unix/Linux]2차그룹부여하기  (0) 2021.06.25
[LINUX]IP임시 설정 방법  (0) 2021.06.21
[Linux]nfs 마운트  (0) 2021.06.10

+ Recent posts