nugawiki

./categories/os

Linux Socket·open files 개수 조정

업데이트 2026-07-21 조회수

리눅스는 소켓도 파일(FD)로 취급. open files 한계를 올려 동시 소켓을 늘린다.

현재 한도

ulimit -Sa    # soft
ulimit -Ha    # hard

/etc/security/limits.conf

* soft nproc unlimited
* hard nproc unlimited
* soft nofile 4096
* hard nofile 8192

FD_SETSIZE (선택, 소스 재빌드 시)

/usr/include/x86_64-linux-gnu/bits/typesizes.h (배포판별 경로 상이):

#define __FD_SETSIZE 4096

재로그인·서비스 재시작 후 ulimit -n으로 확인. 헤더 수정은 재컴파일 영향 큼 — 보통은 limits.conf + systemd LimitNOFILE로 충분.

관련: 리눅스 ulimit 확인·설정

./comments