php-fpm : start_servers, min_spare_servers, max_spare_servers 이해에 도움 프로세스는 한 번에 하나의 웹 클라이언트를

내 서버에 대한 php-fpm 설치를 조정하려고하는데 pm.start_servers, pm.min_spare_serverspm.max_spare_servers변수 로 수행 할 작업을 파악하는 데 어려움이 있습니다. 나는 사용하고있다pm = dynamic

pm.max_children완벽합니다. 각 하위 프로세스는 한 번에 하나의 웹 클라이언트를 제공합니다. 확인. 그렇다면 “서버”는 무엇입니까? 분명히 내가 가진 기본 구성에 따라 1 대의 서버가 둘 이상의 자식을 처리 할 수 ​​있습니다. 상한은 무엇입니까? 어린이 수 / 서버 수에 대한 경험 법칙으로 무엇을 사용해야합니까? 아니면 전혀 관련이 있습니까? 일부 포럼에서 누군가 서버 수는 2 x #의 CPU 코어 여야한다고 주장했지만 그 수가 40-50으로 훨씬 높은 권장 구성을 보았습니다.

PHP 문서 나 많은 “튜닝 php-fpm”기사는 전혀 도움이되지 않았습니다.



답변

기본적으로 php-fpm이 언제든지 실행할 프로세스 수는 원하는대로 설정하면 매우 구성 할 수 dynamic있습니다. 설정 static하면 항상 많은 자식 프로세스가 실행됩니다. 일반적으로 자원을 절약하기 위해 동적으로 설정합니다. 각 하위 프로세스는 하나의 요청을 처리 할 수 ​​있습니다. 상한선은 PHP 응용 프로그램의 용량과 트래픽 양에 따라 다릅니다. 또한 각 아이의 메모리 사용량을 평균 계산하고 있는지 확인해야 결코 아이의 수는 서버에 설치된 램의 금액을 초과 할 수 없다거나 교환을 시작하거나 심지어는 프로세스를 죽이는 시작 커널해야합니다.

; Choose how the process manager will control the number of child processes.
; Possible Values:
;   static  - a fixed number (pm.max_children) of child processes;
;   dynamic - the number of child processes are set dynamically based on the
;             following directives:
;             pm.max_children      - the maximum number of children that can
;                                    be alive at the same time.
;             pm.start_servers     - the number of children created on startup.
;             pm.min_spare_servers - the minimum number of children in 'idle'
;                                    state (waiting to process). If the number
;                                    of 'idle' processes is less than this
;                                    number then some children will be created.
;             pm.max_spare_servers - the maximum number of children in 'idle'
;                                    state (waiting to process). If the number
;                                    of 'idle' processes is greater than this
;                                    number then some children will be killed.
; Note: This value is mandatory.

이러한 옵션을 설정할 때 다음을 고려하십시오.

  • 평균 요청은 얼마나 걸립니까?
  • 사이트에 최대 동시 방문자 수는 몇 명입니까?
  • 각 자식 프로세스는 평균적으로 얼마나 많은 메모리를 사용합니까?

답변