<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Alunduil&#039;s Hosting &#187; wordpress</title>
	<atom:link href="http://www.alunduil.com/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alunduil.com</link>
	<description>Gentoo Hackery and Other Fun ...</description>
	<lastBuildDate>Sun, 01 May 2011 22:00:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Memcached Remote Memory Sharing</title>
		<link>http://www.alunduil.com/2010/06/24/memcached-remote-memory-sharing/</link>
		<comments>http://www.alunduil.com/2010/06/24/memcached-remote-memory-sharing/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 22:15:03 +0000</pubDate>
		<dc:creator>Alex Brandt</dc:creator>
				<category><![CDATA[Linux Guides]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mediawiki]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.alunduil.com/?p=150</guid>
		<description><![CDATA[Introduction Memcached is a simple key/value memory store that allows values from pretty much any application to be stored in memory for quick retrieval. Most languages have simple APIs that make this very easy from a programming standpoint. This also means that it&#8217;s not quite as simple to configure as APC (but similar for modern <a href='http://www.alunduil.com/2010/06/24/memcached-remote-memory-sharing/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<h1>Introduction</h1>
<p>Memcached is a simple key/value memory store that allows values from pretty much any application to be stored in memory for quick retrieval.  Most languages have simple APIs that make this very easy from a programming standpoint.  This also means that it&#8217;s not quite as simple to <a href="http://www.alunduil.com/2010/05/26/apc-caching-php/">configure as APC</a> (but similar for modern applications).</p>
<h1>Installation and Configuration</h1>
<p>To install memcached I recommend using your choice of installation (mine being emerge) and then checking the configuration (again in the case of Gentoo) located at /etc/conf.d/memcached.</p>
<p>Update the file to listen on the interface you want, use the memory you want, etc and then start the daemon up.  Now if you&#8217;re using memcached on the same server as your apache server most webapps will be able to just turn on memcached and connect and work, but if you&#8217;re using memcached and apache on separate servers it&#8217;s a little more work.</p>
<h1>WordPress and memcached</h1>
<p>I&#8217;ve already touted the wordpress plugin: <a href="http://www.w3-edge.com/wordpress-plugins/w3-total-cache/">W3 Total Cache</a> but unfortunately this plugin doesn&#8217;t allow you to easily configure memcached usage through the web interface.  It defaults to using the memcached server located at 127.0.0.1:11211 which if we&#8217;re using separate servers is less than ideal.  The file we need to modify with a simply sed (or by hand if you prefer knowing what&#8217;s going on) is %{DOCROOT}/wp-content/w3-total-cache-config.php.</p>
<p>We just need to change the memcached servers to point at our server&#8217;s location before enabling it in the interface.  To easily accomplish this we can use sed:</p>
<p>sed -i -e &#8216;s/127.0.0.1:11211/: /g&#8217; %{DOCROOT}/wp-content/w3-total-cache-config.php</p>
<h1>Mediawiki and memcached</h1>
<p>The other application we can easily setup for memcached is mediawiki.  Mediawiki wants us to modify its LocalSettings.php with the following additions:</p>
<p>## Shared memory settings<br />
$wgMainCacheType = CACHE_MEMCACHED;<br />
$wgParserCacheType = CACHE_MEMCACHED;<br />
$wgMessageCacheType = CACHE_MEMCACHED;<br />
$wgMemCachedServers = array(&#8220;giskard.alunduil.com:11211&#8243;);</p>
<p>$wgSessionsInMemcached = true;</p>
<p>These settings simply turn on memcached (CACHE_MEMCACHED) for the various caching areas that mediawiki uses and specifies an array of memcached servers to store that caching information in.</p>
<p>If you do have more than one memcached server configured and available you can use the following syntax to include all of them with various weights:</p>
<p>$wgMemCachedServers = array(array(&#8220;host:port&#8221;, weight), array(&#8220;host2:port2&#8243;, weight));</p>
<h1>Conclusion</h1>
<p>Using memcached can greatly improve the performance of webapps or other applications that don&#8217;t need to present the most up to date information.  This can reduce traffic to an overloaded database or configuration file or whatever other store you want to place a cache in front of.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alunduil.com/2010/06/24/memcached-remote-memory-sharing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>APC Caching PHP</title>
		<link>http://www.alunduil.com/2010/05/26/apc-caching-php/</link>
		<comments>http://www.alunduil.com/2010/05/26/apc-caching-php/#comments</comments>
		<pubDate>Thu, 27 May 2010 00:42:57 +0000</pubDate>
		<dc:creator>Alex Brandt</dc:creator>
				<category><![CDATA[Linux Guides]]></category>
		<category><![CDATA[apc]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[w3 total cache]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.alunduil.com/?p=132</guid>
		<description><![CDATA[Introduction Making PHP run faster is usually pretty easy when you see some of the code that people can write (myself included) but what if we either don&#8217;t want to look at their code or don&#8217;t want to fix the code? What else can we do to improve the runtime and the load time of <a href='http://www.alunduil.com/2010/05/26/apc-caching-php/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<h1>Introduction</h1>
<p>Making PHP run faster is usually pretty easy when you see some of the code that people can write (myself included) but what if we either don&#8217;t want to look at their code or don&#8217;t want to fix the code?  What else can we do to improve the runtime and the load time of PHP web sites (this website included)?</p>
<p>We&#8217;ll cover how to use APC (Alternative PHP Cache) to help alleviate some of the issues of a slow web site.  Just like <a href="http://www.alunduil.com/2010/05/23/optimizing-the-am-out-of-lamp/">last time</a> we optimized MySQL and talked about optimizing Apache we&#8217;ll continue on the path to getting PHP applications as fast as we can (without touching a line of code).</p>
<h1>Enter APC</h1>
<p>APC is PEAR project and a PHP module that after installed and a restart of Apache is already doing some work to make life better.  By default APC turns on op-code caching which saves on the compile and execution times of PHP.  The configuration for this module is pretty straight forward, but let&#8217;s look at a copy of the one I&#8217;m using:</p>
<p>; /etc/php/apache2-php5/ext-active/apc.ini (On Gentoo anyways &#8230;)<br />
extension=apc.so<br />
apc.enabled=&#8221;1&#8243;<br />
apc.shm_segments=&#8221;4&#8243;<br />
apc.shm_size=&#8221;128&#8243;<br />
apc.num_files_hint=&#8221;1024&#8243;<br />
apc.ttl=&#8221;7200&#8243;<br />
apc.user_ttl=&#8221;7200&#8243;<br />
apc.gc_ttl=&#8221;3600&#8243;<br />
apc.cache_by_default=&#8221;1&#8243;<br />
;apc.filters=&#8221;"<br />
;apc.mmap_file_mask=&#8221;/tmp/apcphp5.XXXXXX&#8221;<br />
apc.slam_defense=&#8221;0&#8243;<br />
apc.file_update_protection=&#8221;2&#8243;<br />
apc.enable_cli=&#8221;0&#8243;<br />
apc.max_file_size=&#8221;1M&#8221;<br />
apc.stat=&#8221;1&#8243;<br />
apc.write_lock=&#8221;1&#8243;<br />
apc.report_autofilter=&#8221;0&#8243;<br />
apc.include_once_override=&#8221;0&#8243;<br />
apc.rfc1867=&#8221;0&#8243;<br />
apc.rfc1867_prefix=&#8221;upload_&#8221;<br />
apc.rfc1867_name=&#8221;APC_UPLOAD_PROGRESS&#8221;<br />
apc.rfc1867_freq=&#8221;0&#8243;<br />
apc.localcache=&#8221;0&#8243;<br />
apc.localcache.size=&#8221;512&#8243;<br />
apc.coredump_unmap=&#8221;0&#8243;</p>
<h1>Zooming In</h1>
<p>These options are documented fairly thoroughly in the <a href="http://php.net/manual/en/apc.configuration.php">APC PHP Manual</a>.</p>
<p>Most of these options can stay at their defaults and provide a pleasant experience but if we have the memory we should probably tweak these to get more out of them:</p>
<ul>
<li>apc.shm_segments &#8211; The number of chunks to use from /dev/shm.</li>
<li>apc.shm_size &#8211; The size of aforementioned chunks.</li>
</ul>
<p>These two parameters are the heart of APC and dictate the memory usage you&#8217;ll get out of it.  If you take segments*size you&#8217;ll get the maximum amount of shm space used by APC for the cache.  A limitation on shm_size is usually in place through the kernel and to determine what this is you can simply `cat /proc/sys/kernel/shmmax` (remember this command prints out B and APC expects MB).</p>
<h1>Further Caching</h1>
<p>APC also has an object cache available which can be used for just about anything but the application has to be modified to support this.  If you&#8217;re using <a href="http://wordpress.org/">WordPress</a> to host your site an excellent plugin for doing this is <a href="http://www.w3-edge.com/wordpress-plugins/w3-total-cache/">W3 Total Cache</a>.</p>
<h1>Conclusion</h1>
<p>APC can help you get an edge out of your server but, without careful tuning, won&#8217;t get you more than the last inch of performance.  Play with the memory settings until it isn&#8217;t over-utilizing memory (have a larger cache than your code base needs) or under-utilizing memory (having a smaller cache than your code base needs) but don&#8217;t forget you don&#8217;t want it to run into your swap space.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alunduil.com/2010/05/26/apc-caching-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached (User agent is rejected)
Database Caching 2/10 queries in 0.012 seconds using memcached
Object Caching 305/316 objects using memcached

Served from: www.alunduil.com @ 2012-02-07 23:53:04 -->
