1. 문제의 시작
조용히 잠잠히 사용중이던 한 시스템이 급~ 사용자 요청이 증가해서 서비스에 문제가 생겼더랬습니다.(ㅠ_ㅠ)
Windows에 올려둔 Apache HTTP Server가 힘겨워하더라구요..
server status 화면을 보니, 쌓여있던 워커는...1024 거의 max 까지 차고 안되겠더라구요!
Apache 로그에서 아래와 같이 친절하게 알려줍니다.(ㅎㅎ)
[날짜시간...] [mpm_winnt:error] [pid 넘버:tid 넘버] AH00326: Server ran out of threads to serve requests. Consider raising the ThreadsPerChild setting
2. 1차 조치
로그에 나온대로 httpd-mpm.conf 에서 ThreadsPerChild 설정을 올려봅니다. 1024로 설정되어 있던 값을
확~ 2048로 늘렸습니다.
<IfModule mpm_winnt_module>
ThreadsPerChild 2048
MaxConnectionsPerChild 0
</IfModule>
하지만 2048까지는 못가네요. 미처 생각하지 못했던 ThreadLimit 이 있었습니다.
[날짜시간..] [mpm_winnt:warn] [pid 넘버:tid 넘버] AH00445: ThreadsPerChild of 2048 exceeds ThreadLimit of 1920, decreasing to match
3. mpm_winnt에서의 ThreadLimit Directive
를 살펴봅니다.
https://httpd.apache.org/docs/2.4/mod/mpm_common.html <- 이 문서를 참고하시면 됩니다. :)
The default value for ThreadLimit is 1920 when used with mpm_winnt and 64 when used with the others.
winnt 모듈에서의 ThreadLimit default 값이 1920 이라고 하네요!
(참고 : mpm_winnt 사용시 ThreadsPerChild의 default 값은 64이고 나머지mpm들 사용시엔 25 라고 함.)
그러면 이 것도 2048로 설정해주면 될까요? 네네 ThreadsPerChild 보다 좀다 크게 설정해주시면 됩니다.
Apache docs에 설명이 나와있습니다.
각 Hard Limit 이 아래와 같다고 해요. winnt 에서는 15000이 최대네요!
There is a hard limit of ThreadLimit 20000 (or ThreadLimit 100000 with event, ThreadLimit 15000 with mpm_winnt) compiled into the server.
이 이상으로 설정하면 안되냐구요? 음.. nasty effects를 보고 싶지 않으시다면 피하시는 것이 좋겠습니당..ㅎㅎ
그래도 더 늘리고 싶으시다면!
mpm 소스 파일에서 MAX_THREAD_LIMIT 의 value를 바꾸고 리빌드 하시면 되겠습니당!