http://blog.naver.com/kimbumsuc?Redirect=Log&logNo=80155677456
내용 요약
APC binaries for PHP 5.x (windows builds)
http://www.sitebuddy.com/PHP/Accelerators/apc_windows_binaries_builds
http://dev.freshsite.pl/php-accelerators/apc.html
다운로드 관련
http://downloads.php.net/pierre/
테스트 적용
<tbody><tr class="tr-0" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial; ">&lt;td class="td-0" style="font-size: 0.8em; vertical-align: top; padding-top: 0.3em; padding-right: 1em; padding-bottom: 0.3em; padding-left: 1em; border-right-style: solid; border-right-color: rgb(102, 102, 153); border-right-width: 1px; white-space: nowrap; "&gt;Cached Files&lt;/td&gt;&lt;td style="font-size: 0.8em; vertical-align: top; padding-top: 0.3em; padding-right: 1em; padding-bottom: 0.3em; padding-left: 1em; "&gt;**1115 ( 54.0 MBytes)**&lt;/td&gt;</tr><tr class="tr-1" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(221, 221, 221); background-position: initial initial; background-repeat: initial initial; ">&lt;td class="td-0" style="font-size: 0.8em; vertical-align: top; padding-top: 0.3em; padding-right: 1em; padding-bottom: 0.3em; padding-left: 1em; border-right-style: solid; border-right-color: rgb(102, 102, 153); border-right-width: 1px; white-space: nowrap; "&gt;Hits&lt;/td&gt;&lt;td style="font-size: 0.8em; vertical-align: top; padding-top: 0.3em; padding-right: 1em; padding-bottom: 0.3em; padding-left: 1em; "&gt;181380&lt;/td&gt;</tr><tr class="tr-0" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial; ">&lt;td class="td-0" style="font-size: 0.8em; vertical-align: top; padding-top: 0.3em; padding-right: 1em; padding-bottom: 0.3em; padding-left: 1em; border-right-style: solid; border-right-color: rgb(102, 102, 153); border-right-width: 1px; white-space: nowrap; "&gt;Misses&lt;/td&gt;&lt;td style="font-size: 0.8em; vertical-align: top; padding-top: 0.3em; padding-right: 1em; padding-bottom: 0.3em; padding-left: 1em; "&gt;1590&lt;/td&gt;</tr><tr class="tr-1" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(221, 221, 221); background-position: initial initial; background-repeat: initial initial; ">&lt;td class="td-0" style="font-size: 0.8em; vertical-align: top; padding-top: 0.3em; padding-right: 1em; padding-bottom: 0.3em; padding-left: 1em; border-right-style: solid; border-right-color: rgb(102, 102, 153); border-right-width: 1px; white-space: nowrap; "&gt;Request Rate (hits, misses)&lt;/td&gt;&lt;td style="font-size: 0.8em; vertical-align: top; padding-top: 0.3em; padding-right: 1em; padding-bottom: 0.3em; padding-left: 1em; "&gt;2.38 cache requests/second&lt;/td&gt;</tr><tr class="tr-0" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial; ">&lt;td class="td-0" style="font-size: 0.8em; vertical-align: top; padding-top: 0.3em; padding-right: 1em; padding-bottom: 0.3em; padding-left: 1em; border-right-style: solid; border-right-color: rgb(102, 102, 153); border-right-width: 1px; white-space: nowrap; "&gt;Hit Rate&lt;/td&gt;&lt;td style="font-size: 0.8em; vertical-align: top; padding-top: 0.3em; padding-right: 1em; padding-bottom: 0.3em; padding-left: 1em; "&gt;2.36 cache requests/second&lt;/td&gt;</tr><tr class="tr-1" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(221, 221, 221); background-position: initial initial; background-repeat: initial initial; ">&lt;td class="td-0" style="font-size: 0.8em; vertical-align: top; padding-top: 0.3em; padding-right: 1em; padding-bottom: 0.3em; padding-left: 1em; border-right-style: solid; border-right-color: rgb(102, 102, 153); border-right-width: 1px; white-space: nowrap; "&gt;Miss Rate&lt;/td&gt;&lt;td style="font-size: 0.8em; vertical-align: top; padding-top: 0.3em; padding-right: 1em; padding-bottom: 0.3em; padding-left: 1em; "&gt;0.02 cache requests/second&lt;/td&gt;</tr><tr class="tr-0" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial; ">&lt;td class="td-0" style="font-size: 0.8em; vertical-align: top; padding-top: 0.3em; padding-right: 1em; padding-bottom: 0.3em; padding-left: 1em; border-right-style: solid; border-right-color: rgb(102, 102, 153); border-right-width: 1px; white-space: nowrap; "&gt;Insert Rate&lt;/td&gt;&lt;td style="font-size: 0.8em; vertical-align: top; padding-top: 0.3em; padding-right: 1em; padding-bottom: 0.3em; padding-left: 1em; "&gt;0.02 cache requests/second&lt;/td&gt;</tr><tr class="tr-1" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(221, 221, 221); background-position: initial initial; background-repeat: initial initial; ">&lt;td class="td-0" style="font-size: 0.8em; vertical-align: top; padding-top: 0.3em; padding-right: 1em; padding-bottom: 0.3em; padding-left: 1em; border-right-style: solid; border-right-color: rgb(102, 102, 153); border-right-width: 1px; white-space: nowrap; "&gt;Cache full count&lt;/td&gt;&lt;td style="font-size: 0.8em; vertical-align: top; padding-top: 0.3em; padding-right: 1em; padding-bottom: 0.3em; padding-left: 1em; "&gt;0&lt;/td&gt;</tr></tbody>
Host Status Diagrams
<tbody><tr>&lt;td class="td-0" style="font-size: 0.8em; vertical-align: top; padding-top: 0.2em; padding-right: 1em; padding-bottom: 0.4em; padding-left: 1em; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); "&gt;Memory Usage &amp;#xD;
&amp;lt;font size="-2"&amp;gt;(multiple slices indicate fragments)&amp;lt;/font&amp;gt;&lt;/td&gt;&lt;td class="td-1" style="font-size: 0.8em; vertical-align: top; padding-top: 0.2em; padding-right: 1em; padding-bottom: 0.4em; padding-left: 1em; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(221, 221, 221); "&gt;Hits &amp;amp;amp; Misses&lt;/td&gt;</tr><tr>&lt;td class="td-0" style="font-size: 0.8em; vertical-align: top; padding-top: 0.2em; padding-right: 1em; padding-bottom: 0.4em; padding-left: 1em; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); "&gt; Free: 201.8 MBytes (78.8%)&lt;/td&gt;&lt;td class="td-1" style="font-size: 0.8em; vertical-align: top; padding-top: 0.2em; padding-right: 1em; padding-bottom: 0.4em; padding-left: 1em; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(221, 221, 221); "&gt; **Hits: 181380 (99.1%)**&lt;/td&gt;</tr><tr>&lt;td class="td-0" style="font-size: 0.8em; vertical-align: top; padding-top: 0.2em; padding-right: 1em; padding-bottom: 0.4em; padding-left: 1em; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); "&gt; **Used: 54.2 MBytes (21.2%)**&lt;/td&gt;&lt;td class="td-1" style="font-size: 0.8em; vertical-align: top; padding-top: 0.2em; padding-right: 1em; padding-bottom: 0.4em; padding-left: 1em; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(221, 221, 221); "&gt; Misses: 1590 (0.9%)&lt;/td&gt;</tr></tbody>
1000여개의 파일이고 54MB 사이즈를 가지고 있고
99%의 HIT률을 보인다.
좋구나.
APC 튜닝 포인트
- apc.shm_size=256M //쉐어드메모리 사이즈: 너무 작으면 단편화가 너무 많이 생긴다. HITS보다 MISS가 더 생실 수 있으니, 넉넉히…
- apc.stat=1 //0으로 하면 CPU사용률이 조금 내려가지만, 소스파일 수정을 체크하지 않는다. 즉, 그냥 1로 두어라.
- apc.include_once_override=0 //1로 하면 APC에서 include_once(require_once)를 처리한다. CPU사용률이 꽤 내려가지만, PHP의 소스 작성에 따라서 에러가 발생할 수 있다.
- apc.shm_size를 넉넉히 하고
apc.stat=1
apc.include_once_override=0
일 때 CPU IDLE이 56 정도였는데
apc.include_once_override=1로 바꾸니 거의 70까지 CPU IDLE이 높아졌다.
알아낸 버그
- include_once 할 때 경로를 같게하라.
- 한쪽에서는 절대경로, 한쪽에서는 상대 경로로 할경우 class 를 찾을 수 없다는 에러가 발생할 수 있다.(APC 3.1.9 버전에서 확인)
- 해결법은 상대 경로일 경우
include_once(‘../../lib/class.CCCC.php’);
->
include_once(dirname(_FILE).’/../../lib/class.CCCC.php’);
처럼 바꿔서 전부 절대경로를 사용하도록 한다.
- 아니면 APC를 끄던가.
🔗original-link