{"id":567,"date":"2011-06-06T18:19:29","date_gmt":"2011-06-06T18:19:29","guid":{"rendered":"http:\/\/blog.designed79.co.uk\/?p=567"},"modified":"2012-07-27T16:01:37","modified_gmt":"2012-07-27T16:01:37","slug":"apc-ini-starting-point","status":"publish","type":"post","link":"https:\/\/blog.designed79.co.uk\/?p=567","title":{"rendered":"APC.INI starting point"},"content":{"rendered":"<div id=\"content-header\">\n<h1>Tune APC to Improve PHP Performance<\/h1>\n<\/div>\n<div>\n<div id=\"content-area\">\n<div id=\"node-78\">\n<div>\n<div>\n<h2>Adjust the parameters<\/h2>\n<p>Having installed APC for PHP does not automatically improve the performance. You have to adjust the parameters. At the very least, change these values:<\/p>\n<p>apc.ttl=&#8221;7200&#8243;<br \/>\napc.user_ttl=&#8221;7200&#8243;<br \/>\napc.shm_segments=&#8221;3&#8243;<br \/>\napc.shm_size=&#8221;90&#8243;<\/p>\n<p>Setting\u00a0<em>apc.ttl<\/em> and\u00a0<em>apc.user_ttl<\/em> to none-zero can ensure that the cached php code gets refreshed at the given number of seconds without filling up the memory with stale entries.<\/p>\n<p>The number assigned to\u00a0<em>apc.shm_size<\/em> is the size of each shared memory segment in MB. To find the Linux kernel&#8217;s maximum shared memory size, do<\/p>\n<p># cat \/proc\/sys\/kernel\/shmmax<\/p>\n<p>If you already set the\u00a0<em>apc.shm_size<\/em> to the maximum allowed size, then raising the value of<em>apc.shm_segments<\/em> would be the next thing to do.<\/p>\n<p>Of course you can always raise the maximum size of a shared memory segment, using\u00a0<em>sysctl<\/em>. Do this only when you know what you are doing. Run &#8220;<em>man sysctl<\/em>&#8221; for more information.<\/p>\n<h2>MMAP v.s. System V IPC<\/h2>\n<p>I did an experiment on APC version 3.0.14, on a system using mmap for shared memory. It seems that APC simply ignores the value in\u00a0<em>apc.shm_segments<\/em> and go with the setting in\u00a0<em>apc.shm_size<\/em>, and it accepts values larger than the maximum allowed size for each segment. In other words, it takes apc.shm_segments as 1, and accepts whatever value in apc.shm_size. This does conflict with the APC documentation. I saw others have filed similar bug for APC. I suggest you test this yourself and see if\u00a0 things have changed since.<\/p>\n<h2>apc.php<\/h2>\n<p>To see how your APC is doing, locate the\u00a0<em>apc.php<\/em> that comes with the extension, copy it to the document root, and access it from a browser. Please remember to remove this file from public access for security.<\/p>\n<p>Reference:\u00a0<a title=\"http:\/\/www.php.net\/apc\" href=\"http:\/\/www.php.net\/apc\">http:\/\/www.php.net\/apc<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h2>NOTE:<\/h2>\n<p>If you want the graphics to display using the apc.php, you MUST have GD2 libraries and php5-gd installed !!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tune APC to Improve PHP Performance Adjust the parameters Having installed APC for PHP does not automatically improve the performance. You have [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-567","post","type-post","status-publish","format-standard","hentry","category-info-on-tech"],"_links":{"self":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/567","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=567"}],"version-history":[{"count":0,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/567\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=567"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=567"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}