익명 사용자
로그인하지 않음
토론
기여
계정 만들기
로그인
IT 위키
검색
PHP-FPM pm.max children
편집하기
IT 위키
이름공간
문서
토론
더 보기
더 보기
문서 행위
읽기
편집
원본 편집
역사
경고:
로그인하지 않았습니다. 편집을 하면 IP 주소가 공개되게 됩니다.
로그인
하거나
계정을 생성하면
편집자가 사용자 이름으로 기록되고, 다른 장점도 있습니다.
스팸 방지 검사입니다. 이것을 입력하지
마세요
!
'''pm.max_children''' is a directive in PHP-FPM (FastCGI Process Manager) configuration that specifies the maximum number of child processes that can be created to handle incoming requests. This setting is critical for managing server resources and ensuring that PHP-FPM can efficiently handle concurrent traffic without overloading the server. ==Overview== *The `pm.max_children` directive determines the upper limit on the number of simultaneous PHP-FPM worker processes. *When the number of incoming requests exceeds `pm.max_children`, additional requests are queued until a process becomes available. *This setting is applicable for all process management modes (`dynamic`, `static`, and `ondemand`). ==Syntax== The directive is configured in the PHP-FPM pool configuration file (e.g., `www.conf`).<syntaxhighlight lang="ini"> pm = dynamic pm.max_children = 50 </syntaxhighlight> ==How It Works== *'''In `dynamic` mode:''' **Child processes are created as needed, but the total number of processes cannot exceed `pm.max_children`. *'''In `static` mode:''' **The server always creates exactly `pm.max_children` processes. *'''In `ondemand` mode:''' **Processes are spawned only when requests arrive, but the total number of processes is still limited by `pm.max_children`. ==Configuration Example== Here’s an example configuration for a PHP-FPM pool:<syntaxhighlight lang="ini"> [www] pm = dynamic pm.max_children = 50 pm.start_servers = 5 pm.min_spare_servers = 2 pm.max_spare_servers = 10 </syntaxhighlight> ===Explanation=== *'''pm = dynamic''': Enables dynamic process management mode. *'''pm.max_children = 50''': Limits the total number of worker processes to 50. *'''pm.start_servers = 5''': Starts with 5 worker processes when PHP-FPM initializes. *'''pm.min_spare_servers = 2''': Maintains at least 2 idle processes. *'''pm.max_spare_servers = 10''': Limits the number of idle processes to 10. ==Key Considerations== *'''Server Resources:''' Setting `pm.max_children` too high can lead to excessive memory and CPU usage, potentially causing server instability. *'''Application Demand:''' The value should be high enough to handle peak traffic without excessive queuing or delays. *'''Queue Length:''' When the number of requests exceeds `pm.max_children`, requests are queued. Monitor the queue length to determine if the value needs adjustment. ==How to Calculate pm.max_children== To calculate the optimal value for `pm.max_children`, consider the following: *'''Available Memory:''' Ensure that the total memory usage of PHP-FPM processes does not exceed the server's physical memory. *'''Memory Usage Per Process:''' Monitor the average memory usage of each PHP-FPM process using tools like `top` or `htop`. ===Formula=== <syntaxhighlight lang="plaintext"> pm.max_children = (Total RAM - Other Services Memory) / Average PHP-FPM Process Memory </syntaxhighlight> ==Monitoring and Troubleshooting== Use the `php-fpm` status page or tools like `htop` to monitor: *The number of active processes. *Memory and CPU usage. *Request queues, which indicate whether `pm.max_children` needs adjustment. ===Example Issues=== *'''502 Bad Gateway Errors:''' **Cause: Requests are queued due to insufficient child processes. **Solution: Increase `pm.max_children` or optimize the application to reduce resource usage. *'''High Memory Usage:''' **Cause: `pm.max_children` is set too high for the server's available memory. **Solution: Reduce `pm.max_children` and ensure enough resources are available. ==Related Directives== *'''pm.start_servers:''' Defines the number of worker processes created on startup. *'''pm.min_spare_servers:''' Sets the minimum number of idle worker processes. *'''pm.max_spare_servers:''' Limits the maximum number of idle worker processes. *'''pm.process_idle_timeout:''' Specifies the timeout for idle processes in `ondemand` mode. ==See Also== *[[PHP-FPM]] *[[Dynamic Process Management]] *[[pm.min_spare_servers]] *[[pm.max_spare_servers]]
요약:
IT 위키에서의 모든 기여는 크리에이티브 커먼즈 저작자표시-비영리-동일조건변경허락 라이선스로 배포된다는 점을 유의해 주세요(자세한 내용에 대해서는
IT 위키:저작권
문서를 읽어주세요). 만약 여기에 동의하지 않는다면 문서를 저장하지 말아 주세요.
또한, 직접 작성했거나 퍼블릭 도메인과 같은 자유 문서에서 가져왔다는 것을 보증해야 합니다.
저작권이 있는 내용을 허가 없이 저장하지 마세요!
취소
편집 도움말
(새 창에서 열림)
둘러보기
둘러보기
대문
최근 바뀜
광고
위키 도구
위키 도구
특수 문서 목록
문서 도구
문서 도구
사용자 문서 도구
더 보기
여기를 가리키는 문서
가리키는 글의 최근 바뀜
문서 정보
문서 기록