웹사이트 최적화 - 리눅스 커널 + Nginx 최적화하기.
리눅스 커널 셋팅 - fs.file-max 모든 프로세스에 대해 열린 파일의 최대 수를 지정합니다.
vi /etc/sysctl.conf
fs.file-max=65536
net.ipv4.tcp_keepalive_intvl = 15
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_time = 30
net.core.netdev_max_backlog=2500
net.ipv4.tcp_retries1=3
net.ipv4.tcp_retries2=3
net.core.rmem_max=56777216
net.core.rmem_default=16777216
net.core.wmem_max=56777216
net.core.wmem_default=16777216
net.ipv4.tcp_window_scaling=1
net.ipv4.tcp_orphan_retries=0
net.ipv4.tcp_sack=0
net.ipv4.tcp_fin_timeout=15
vi /etc/security/limits.conf
nginx hard nproc 10240
nginx soft nproc 10240
nginx hard nofile 204800
nginx soft nofile 204800
2. nginx 설정하기
- worker_rlimit_nofile 204800;
이벤트쪽 - worker_connections 8192; # 동시에 8192개의 요청을 받을수 있습니다.]
- multi_accept on; # 순차적으로 요청을 받지 않고 동시에 요청을 접수합니다.
- use epoll