nginx 성능 설정

Code 2023. 12. 29. 02:18


//-------------------------------------
* worker_processes
생성할 worker process 수

worker_processes auto; 로 설정하면 cpu 코어 수 만큼을 자동으로 worker process 생성

- 확인
nginx 상태 보기
> sudo systemctl status nginx
or
> ps -lfC nginx


//-------------------------------------
* worker_connections 
각 Worker 프로세스 별 최대 허용 커넥션 개수 

기본값 : 768
1024 이상으로  추천


//-------------------------------------
* worker_rlimit_nofile
Worker Process 가 열수있는 최대 파일 수를 제한

/etc/security/limits.conf 의 설정에 따름
nginx 를 실행하는 계정을 수정

www-data    soft   nofile    204800
www-data    hard   nofile    204800

- 설정예
worker_rlimit_nofile 204800;



//-------------------------------------
https://velog.io/@msung99/Nginx-Worker-프로세스와-httpEvent-영역을-튜닝하여-성능최적화
https://www.cloudbees.com/blog/tuning-nginx

 

반응형
Posted by codens