<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://www.jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://www.jackxiang.com/post//</link>
<title><![CDATA[PHP 使用 APC 增進執行速度之apc_stat=0。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Sat, 15 Sep 2012 14:16:15 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	PHP APC apc stat=0:<br/><br/>如果你覺得自己的 PHP 網站不快，可以在自己的 php.ini 裡面，load 進來 apc.so 後面加上 apc.stat=0 ，對樣對網站的效能會有顯著地提昇。原理是因為 APC 在每次讀取 PHP 程式碼的時候，都會先 stat() 程式碼所在的檔案，以確定要不要重新編譯成 OPCODE ，而 apc.stat=0 則是直接省略 stat() 的步驟，拿原本就有的 opcode 來用。<br/><br/>而當使用了 APC 並且設置 apc.stat=0 之後，其實網站在第一次編譯成 OPCODE 之後，除非重起或是清除快取，要不然就是會一直拿 OPCODE 來跑，而這樣速度也因此有了顯著的提升<br/><br/>当然重启动一下Apache也是可以自动再次加载一次的。<br/><br/><br/>假設有一段程式碼如下：<br/><br/>PHP<br/><textarea name="code" class="php" rows="15" cols="100">
&lt;?php
&nbsp;&nbsp;&nbsp;&nbsp;include_once(&#039;/www/includes/1.inc&#039;);
&nbsp;&nbsp;&nbsp;&nbsp;include_once(&#039;/www/includes/2.inc&#039;);
&nbsp;&nbsp;&nbsp;&nbsp;include_once(&#039;/www/includes/3.inc&#039;);
&nbsp;&nbsp;&nbsp;&nbsp;include_once(&#039;/www/includes/4.inc&#039;);
&nbsp;&nbsp;&nbsp;&nbsp;include_once(&#039;/www/includes/5.inc&#039;);
&nbsp;&nbsp;&nbsp;&nbsp;include_once(&#039;/www/includes/6.inc&#039;);
&nbsp;&nbsp;&nbsp;&nbsp;include_once(&#039;/www/includes/7.inc&#039;);
&nbsp;&nbsp;&nbsp;&nbsp;include_once(&#039;/www/includes/8.inc&#039;);
&nbsp;&nbsp;&nbsp;&nbsp;include_once(&#039;/www/includes/9.inc&#039;);
&nbsp;&nbsp;&nbsp;&nbsp;include_once(&#039;/www/includes/10.inc&#039;);

&nbsp;&nbsp;&nbsp;&nbsp;echo &#039;ok&#039;;
?&gt;
</textarea><br/>則在背後 APC 的動作會像是上面這張圖一樣，可以看得出來 apc.stat=0 時，省了非常多的 stat() 。<br/><br/>来自：http://blog.roga.tw/2011/07/php-%E4%BD%BF%E7%94%A8-apc-%E5%A2%9E%E9%80%B2%E5%9F%B7%E8%A1%8C%E9%80%9F%E5%BA%A6%E3%80%82/<br/>对比可见，当apc.stat=0时，省了很多系统内核调用,我们没有看到系统内核调用stat64了。其中，i3.php和i4.php分别是php的include_once和require_once函数调用，它要交给fstat()系统内核调用来检查文件是否打开过。单从性能角度出发的话,require比require_once性能更佳。<br/><br/>设置apc.stat_ctime的意义并是很大。如果apc.stat_ctime值为1时，仅当php源文件的创建时间(ctime)大于php源文件的最后修改时间(mtime)时，缓存对象的mtime时间会被php源文件的ctime所代替，否则缓存对象的mtime依然记录为php源文件的mtime。这样做是防止通过cvs, svn或者rsync等工具刷新php源文件的mtime，这样会导致APC通过比对php源文件的创建时间ctime来决定缓存对象有没有过期。我们推荐该保持默认值，即apc.stat_ctime = 0<br/><br/>http://www.perfgeeks.com/?p=298
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] PHP 使用 APC 增進執行速度之apc_stat=0。]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>