<?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>High performance web site building, server optimization &#187; Caching</title>
	<atom:link href="http://www.megaburst.com/category/caching/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.megaburst.com</link>
	<description>High performance web site building</description>
	<lastBuildDate>Sat, 15 May 2010 21:14:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Nginx high performance proxy caching system</title>
		<link>http://www.megaburst.com/nginx-high-performance-proxy-caching-system/</link>
		<comments>http://www.megaburst.com/nginx-high-performance-proxy-caching-system/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 20:09:30 +0000</pubDate>
		<dc:creator>Kai</dc:creator>
				<category><![CDATA[Caching]]></category>
		<category><![CDATA[Server performance]]></category>

		<guid isPermaLink="false">http://www.megaburst.com/?p=138</guid>
		<description><![CDATA[Nginx has been built with ncache in the core. It&#8217;s very fast and offers great performance. It works quite nicely &#8211; you install nginx as a front-end proxy server and forward all php queries to Apache back-end. Then you set-up nginx to cache response from Apache back-end to static files on a file system (or [...]]]></description>
			<content:encoded><![CDATA[<p>Nginx has been built with ncache in the core. It&#8217;s very fast and offers great performance. It works quite nicely &#8211; you install nginx as a front-end proxy server and forward all php queries to Apache back-end. Then you set-up nginx to cache response from Apache back-end to static files on a file system (or even RAM disk).</p>
<p>in http{} section please define the path to proxy cache, levels, keys_zone name, expire time in minutes and max size in megabytes:</p>
<blockquote><p>
proxy_cache_path  /path/to/cache  levels=1:2   keys_zone=staticfilecache:180m  max_size=500m;<br />
proxy_temp_path /path/to/proxy_temp;</p></blockquote>
<p>Please note that proxy_cache_path and proxy_temp_path should be on the same file system.</p>
<blockquote><p>
proxy_cache_key &#8220;$scheme://$host$request_uri $do_not_cache&#8221;;<br />
proxy_cache staticfilecache;</p></blockquote>
<p>in server {} location setting you should define the following values/settings:</p>
<blockquote><p>
proxy_cache_valid 200 15m;
</p></blockquote>
<p>The above caching settings will cache all valid 200 response for 15 minutes.</p>
        <p><center>&copy; MegaBurst.com - visit the <a href="http://www.megaburst.com/">high performance</a> web site building blog.</center></p>      ]]></content:encoded>
			<wfw:commentRss>http://www.megaburst.com/nginx-high-performance-proxy-caching-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Increase your wordpress performance with W3 Total Cache plugin</title>
		<link>http://www.megaburst.com/increase-your-wordpress-performance-with-w3-total-cache-plugin/</link>
		<comments>http://www.megaburst.com/increase-your-wordpress-performance-with-w3-total-cache-plugin/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 19:02:37 +0000</pubDate>
		<dc:creator>Kai</dc:creator>
				<category><![CDATA[Caching]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.megaburst.com/?p=128</guid>
		<description><![CDATA[We have been using memcached for quite long time with a very great success. It&#8217;s fast, it&#8217;s quite easy to use and incorporate in existing code. Furthermore, it&#8217;s totally free. Memcached caches value/key pair in RAM, thus giving fast access to it when you require.
Now, if you want to boost performance of your Wordpress blog [...]]]></description>
			<content:encoded><![CDATA[<p>We have been using memcached for quite long time with a very great success. It&#8217;s fast, it&#8217;s quite easy to use and incorporate in existing code. Furthermore, it&#8217;s totally free. Memcached caches value/key pair in RAM, thus giving fast access to it when you require.</p>
<p>Now, if you want to boost performance of your Wordpress blog it&#8217;s quite easy &#8211; get a <a href="http://wordpress.org/extend/plugins/w3-total-cache/">W3-total-cache plugin</a>, configure it and you are set (remember, you will need a memcached server running otherwise you can&#8217;t use memcached &#8220;storage&#8221; from W3-total-cache plugin).</p>
<p>In our tests it boosted our Wordpress blog performance from 20-200% depending on different scenarios. Very nice plugin and it&#8217;s quite easy to set-up. Get it now.</p>
        <p><center>&copy; MegaBurst.com - visit the <a href="http://www.megaburst.com/">high performance</a> web site building blog.</center></p>      ]]></content:encoded>
			<wfw:commentRss>http://www.megaburst.com/increase-your-wordpress-performance-with-w3-total-cache-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wordpress caching plugin &#8211; 1 Blog Cacher</title>
		<link>http://www.megaburst.com/wordpress-caching-plugin-1-blog-cacher/</link>
		<comments>http://www.megaburst.com/wordpress-caching-plugin-1-blog-cacher/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 17:17:12 +0000</pubDate>
		<dc:creator>Kai</dc:creator>
				<category><![CDATA[Caching]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.megaburst.com/?p=102</guid>
		<description><![CDATA[Ok folks, I have some great news for you &#8211; we just spot a promising wordpress caching plugin named 1 Blog Cacher.  From the list of features it looks very awesome including the file and directory structure emulation, thus you can easily remove cached directories or file cache that you require. This is a nice [...]]]></description>
			<content:encoded><![CDATA[<p>Ok folks, I have some great news for you &#8211; we just spot a promising wordpress caching plugin named <a href="http://1blogcacher.com/">1 Blog Cacher</a>.  From the list of features it looks very awesome including the file and directory structure emulation, thus you can easily remove cached directories or file cache that you require. This is a nice feature if you are using  scripts  (e.g. you want to wipe out all cache files for /2006/ directory).</p>
<p>Expire header option is also a very nice feature &#8211; you have full control when to expire the cache.</p>
<p>I am sure we will use this plugin for some in-house tests and then use it on some high load blogs we manage for our clientele. We will keep you posted!</p>
        <p><center>&copy; MegaBurst.com - visit the <a href="http://www.megaburst.com/">high performance</a> web site building blog.</center></p>      ]]></content:encoded>
			<wfw:commentRss>http://www.megaburst.com/wordpress-caching-plugin-1-blog-cacher/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generate static content for performance</title>
		<link>http://www.megaburst.com/generate-static-content-for-performance/</link>
		<comments>http://www.megaburst.com/generate-static-content-for-performance/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 19:52:21 +0000</pubDate>
		<dc:creator>Kai</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Caching]]></category>

		<guid isPermaLink="false">http://www.megaburst.com/?p=11</guid>
		<description><![CDATA[Running a very popular and high-bandwidth website or blog? The load is killing the server? The website content is generated in real-time using PHP, .NET or CGI scripts?
You can easily increase your website performance by generating static files and serving such files much faster rather than generating files in real-time. Static files can be kept [...]]]></description>
			<content:encoded><![CDATA[<p>Running a very popular and high-bandwidth website or blog? The load is killing the server? The website content is generated in real-time using PHP, .NET or CGI scripts?</p>
<p>You can easily increase your website performance by generating static files and serving such files much faster rather than generating files in real-time. Static files can be kept on the hard drive or in memory for blazing fast access, for example, using <em>memcached</em>.</p>
<p><strong>Generating PHP static content</strong><br />
You can generate PHP output in multiple ways &#8211; from PHP code directly writing output to files or by fetching specific PHP output via HTTP protocol, or using PERL code. If you are using specific web server based values and features &#8211; you will have to fetch file via HTTP and write output to local file. This is very easy to do and doesn&#8217;t require much programming skill.</p>
<p>Fetching file via HTTP using <em>WGET</em></p>
<p><em>wget </em><a href="http://www.yourdomainishereo.com/page1.php"></a><em><a href="http://www.yourdomainishereo.com/page1.php">http://www.your-domain-is-here.com/page1.php</a></em><em> -O /var/www/page1.html</em></p>
<p>Where <em>/var/www/page1.html</em> is the output file.</p>
<p>Fetching file using CURL</p>
<p><em>curl -o </em><em>/var/www/page1.html</em><em> </em><a href="http://www.yourdomainishereo.com/page1.php"></a><em><a href="http://www.yourdomainishereo.com/page1.php">http://www.your-domain-is-here.com/page1.php</a></em></p>
<p><em>fetch -o /var/www/page1.html </em><em><a href="http://www.yourdomainishereo.com/page1.php">http://www.your-domain-is-here.com/page1.php</a></em></p>
<p><em>lynx -source </em><em><a href="http://www.yourdomainishereo.com/page1.php">http://www.your-domain-is-here.com/page1.php</a> &gt; /var/www/page1.html</em></p>
<p>Generating php output using a PHP script:</p>
<p><em>&lt;?php<br />
$files = file(&#8220;filelist.txt&#8221;);<br />
for($i = 0; $i &lt; count($files); $i++) {<br />
ob_start();<br />
include($files[$i]);<br />
$page = ob_get_contents();<br />
ob_end_clean();<br />
if(strpos($files[$i], &#8220;.php&#8221;) &gt; -1) {<br />
$file = fopen(substr($files[$i], -4) . &#8220;.html&#8221;);<br />
fputs($file, $page);<br />
fclose($file);<br />
}<br />
}<br />
?&gt;</em></p>
<p>where <em>filelist.txt</em> is the list of the files with every file listed in new line you want it to be generated.</p>
<p>Perl code for fetching a remote website page. Please save the following code into the filename <em>fetch.pl</em>:</p>
<p><em>#!/usr/bin/perl</em></p>
<p><em>use LWP::Simple;<br />
getprint &#8220;</em><em><a href="http://www.yourdomainishereo.com/page1.php">http://www.your-domain-is-here.com/page1.php</a>&#8220;;<br />
$content = get( $url );<br />
print $content;</em></p>
<p>And then run it with the following Linux command line:</p>
<p><em>perl fetch.pl &gt; outputfile.html</em></p>
<p>In the next article we will review a solution where website content is saved to <em>memcached</em> and content served from fast memory-based cache without generating content on the fly.</p>
        <p><center>&copy; MegaBurst.com - visit the <a href="http://www.megaburst.com/">high performance</a> web site building blog.</center></p>      ]]></content:encoded>
			<wfw:commentRss>http://www.megaburst.com/generate-static-content-for-performance/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using eAccelerator for PHP op-code caching</title>
		<link>http://www.megaburst.com/using-eaccelerator-for-php-op-code-caching/</link>
		<comments>http://www.megaburst.com/using-eaccelerator-for-php-op-code-caching/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 20:26:33 +0000</pubDate>
		<dc:creator>Kai</dc:creator>
				<category><![CDATA[Caching]]></category>

		<guid isPermaLink="false">http://www.megaburst.com/?p=50</guid>
		<description><![CDATA[In the last years we have tested and ran multiple PHP op-code caching software for forums, php powered web sites and Wordpress blogs. Performance wise the eAccelerator was our top-performer and we haven&#8217;t experienced problems with it.
eAccelerator is also a good choice for Wordpress blog hosting and this op-code cache doesn&#8217;t cause problems with WP [...]]]></description>
			<content:encoded><![CDATA[<p>In the last years we have tested and ran multiple PHP op-code caching software for forums, php powered web sites and Wordpress blogs. Performance wise the eAccelerator was our top-performer and we haven&#8217;t experienced problems with it.</p>
<p>eAccelerator is also a good choice for Wordpress blog hosting and this op-code cache doesn&#8217;t cause problems with WP plugins &#8211; WP Super Cache, WP Cache and even when you run memcached caching.</p>
<p>Our standard settings for eAccelerator in 99% solutions is as follows:</p>
<p><em>zend_extension=&#8221;/usr/local/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so&#8221;<br />
eaccelerator.shm_size=&#8221;16&#8243;<br />
eaccelerator.cache_dir=&#8221;/tmp/eaccelerator&#8221;<br />
eaccelerator.enable=&#8221;1&#8243;<br />
eaccelerator.optimizer=&#8221;1&#8243;<br />
eaccelerator.check_mtime=&#8221;1&#8243;<br />
eaccelerator.debug=&#8221;0&#8243;<br />
eaccelerator.filter=&#8221;"<br />
eaccelerator.shm_max=&#8221;0&#8243;<br />
eaccelerator.shm_ttl=&#8221;0&#8243;<br />
eaccelerator.shm_prune_period=&#8221;0&#8243;<br />
eaccelerator.shm_only=&#8221;0&#8243;<br />
eaccelerator.compress=&#8221;1&#8243;<br />
eaccelerator.compress_level=&#8221;9&#8243;</em></p>
        <p><center>&copy; MegaBurst.com - visit the <a href="http://www.megaburst.com/">high performance</a> web site building blog.</center></p>      ]]></content:encoded>
			<wfw:commentRss>http://www.megaburst.com/using-eaccelerator-for-php-op-code-caching/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Caching content to disk using Tugela cache</title>
		<link>http://www.megaburst.com/caching-content-to-disk-using-tugela-cache/</link>
		<comments>http://www.megaburst.com/caching-content-to-disk-using-tugela-cache/#comments</comments>
		<pubDate>Mon, 07 Jan 2008 23:43:30 +0000</pubDate>
		<dc:creator>Kai</dc:creator>
				<category><![CDATA[Caching]]></category>

		<guid isPermaLink="false">http://www.megaburst.com/caching/caching-content-to-disk-using-tugela-cache/</guid>
		<description><![CDATA[Today many folks use memcached for fast memory data access because RAM is cheap. However, for some heavyweight websites, 16GB of RAM or even 32GB is not enough, and keeping a lot of data in the RAM becomes expensive. It&#8217;s time to cache your content and data to hard disk using Tugela cache a &#8220;clone&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Today many folks use <em>memcached</em> for fast memory data access because RAM is cheap. However, for some heavyweight websites, 16GB of RAM or even 32GB is not enough, and keeping a lot of data in the RAM becomes expensive. It&#8217;s time to cache your content and data to hard disk using <strong>Tugela cache</strong> a &#8220;clone&#8221; derived from <em>memcached</em>. It will cache data in BerkeleyDB B-Tree database on the file system. Tugela cache is fast and compatible with <em>memcached</em> APIs; it will be a smooth transition to Tugela cache if you are already taking advantage of <em>memcached</em>.</p>
<p>Remember, it&#8217;s always better to run a few small inexpensive boxes rather than a big &#8220;monster.&#8221; You can always buy 5 boxes with 4GB RAM each for dedicated <em>memcached</em> servers. This will make a total of about 20GB for data caching. It will also provide redundancy, but may also add problems with keeping the state, unless you do memcached sharding and applications can determine where to fetch the data.</p>
<p>Scaling your all servers and services vertically is the KEY.</p>
        <p><center>&copy; MegaBurst.com - visit the <a href="http://www.megaburst.com/">high performance</a> web site building blog.</center></p>      ]]></content:encoded>
			<wfw:commentRss>http://www.megaburst.com/caching-content-to-disk-using-tugela-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smart caching for websites and blogs</title>
		<link>http://www.megaburst.com/smart-caching-for-web-sites-and-blogs/</link>
		<comments>http://www.megaburst.com/smart-caching-for-web-sites-and-blogs/#comments</comments>
		<pubDate>Thu, 03 Jan 2008 21:45:52 +0000</pubDate>
		<dc:creator>Kai</dc:creator>
				<category><![CDATA[Caching]]></category>

		<guid isPermaLink="false">http://www.megaburst.com/caching/smart-caching-for-web-sites-and-blogs/</guid>
		<description><![CDATA[If you are creating a new website or modifying an existing one, you should always keep in mind that site speed depends on many factors. From the very beginning, you should carefully plan your site architecture, code and overall structure to make sure your site is easy scalable in the future without huge expenses and [...]]]></description>
			<content:encoded><![CDATA[<p>If you are creating a new website or modifying an existing one, you should always keep in mind that site speed depends on many factors. From the very beginning, you should carefully plan your site architecture, code and overall structure to make sure your site is easy scalable in the future without huge expenses and a great deal of infrastructure changes.</p>
<p>One of the most important performance boosts is the use of caching. In this guide, we will review multiple caching strategies that will boost your website performance and, if done correctly, decrease your site loading times and offer better online experience to your web visitors.</p>
<p><em><strong>Javascript code.</strong></em><br />
It&#8217;s better to place Javascript code into external JS files and then call from the HTML or PHP code. By using this method, we take advantage of caching. This works great if you have a Javascript code used on multiple pages.</p>
<p><em>Example:</em></p>
<p><em>&lt;script language=&#8221;JavaScript&#8221; src=&#8221;http://www.yourwebsitegoeshere.com/mycode.js&#8221; type=&#8221;text/JavaScript&#8221;&gt;&lt;/script&gt;</em></p>
<p><em><strong>Style sheets.</strong></em><br />
Move all CSS definitions to an external file, and call the file from your HTML or PHP code.</p>
<p><em>Example:</em></p>
<p><em>&lt;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; href=&#8221;http://www.yourwebsitegoeshere.com/my-own.css&#8221;/&gt;</em></p>
<p><strong><em>Database queries.</em></strong><br />
The more database queries you use to generate the website or blog, the higher load it will place on your database server. This will add extra latency, and if you are getting a high number of concurrent web visitors (for example &#8220;<em>Slashdot&#8221;</em> effect), it may cripple the server, causing a halt. You may want to check out <em>memcached</em> and implement it in your website or blog code. It&#8217;s also very important to have the right indexes on the database tables. Limit <em>SQL SELECT</em> queries with <em>LIMIT, </em> you don&#8217;t need to select all table rows if you need to display only 10 records from 1,520.</p>
<p>If you have millions of records, a database sharding must be implemented. You can split records in multiple tables or even databases this will provide much lower query latency and greatly speed up your MySQL performance.  With database sharding, you can also easily lower index creation time, as well as increase and scale <em>INSERT</em> and <em>UPDATE</em> operations.</p>
<p><strong>Wordpress blog caching</strong><br />
By default, Wordpress works perfectly fine even for popular blogs when there are no high bursts of concurrent connections . If you get Dugg, the standard Wordpress install will not scale, and most likely the server hosting your blog will be inaccessible. Wordpress uses PHP to generate output on the fly thus, all pages are generated in real time, including data from the database.</p>
<p>If your content doesn&#8217;t change that often, why generate files on the fly all the time? Correct. There are <em>wp-cache</em> and <em>wp super cache</em> plug-ins that offer Wordpress caching. In other words, the plug-in will generate a static file on the server hard drive and serve it to visitors without querying the database at all. When the content changes, the static cache file is removed and a new file is generated once again.</p>
<p>You can also offload static content to Content Delivery Network (CDN) &#8211; see below. Offload static content section, or serve static images from a different server that is optimized to serve static content only.</p>
<p><strong>Memcached</strong><br />
<em> Memcached</em> is perfect for file, data and SQL query caching that is heavily used and accessed. Caching is very good and recommended for content that is not so important to be generated from database back-end in real-time. Examples include recent comments, statistics, logged-in users in the system and news links.</p>
<p>Please keep in mind that there&#8217;s little of benefit to caching MySQL queries or files in <em>memcached</em> if the output is dedicated for one user only for example, a customer control panel displaying client-only settings or dynamic content that depends on cookies or very specific <em>GET</em> values.</p>
<p><strong>Offloading static content</strong><br />
From the very beginning implement static content separate URL from your main site. Separate static content from dynamic content serving URL &#8211; for example, with subdomain <em>http://images.yourwebsiteishere.com/</em> so that all images are served from this URL.</p>
<p>At the very beginning, you can have <em>http://images.yourwebsiteishere.com/ </em>on the same server to save on hosting expenses. When your site or blog grows, this will allow more flexibility in the future, and you can then point this URL to a Content Delivery Network like <a href="http://www.akamai.com/">Akamai</a> or <a href="http://www.valuecdn.com/" title="Value CDN">ValueCDN</a>, serve images from another server and so on.</p>
<p><strong>Apache mod_expires </strong><br />
You should implement the <em>HTTP protocol expire</em> header feature to lower the hits for content that doesn&#8217;t change very often, including images, CSS, Javascript and even static HTML content. You need to compile Apache with <em>mod_expires</em> module for this to work.  For Apache2, you need to add the <code><em>--enable-expires</em> switch to <em>./configure</em> line.</code></p>
<p>Next, you activate it with the <em><code>LoadModule expires_module modules/mod_expires.so</code></em>  line.</p>
<p>Then, add the following lines to the Apache configuration file (usually <em>httpd.conf</em>). You can also add this to <em>.htaccess</em> but from the performance point of view, it&#8217;s better to have in <em>httpd.conf.</em></p>
<p><em>&lt;IfModule mod_expires.c&gt;<br />
ExpiresActive on<br />
ExpiresByType image/jpg &#8220;access plus 1 weeks&#8221;<br />
ExpiresDefault &#8220;access plus 1 days&#8221;<br />
&lt;/IfModule&gt;</em></p>
<p><em> ExpiresByType image/jpg &#8220;access plus 1 weeks&#8221;</em> tells the browser to reload the file with the document type <em>image/jpg</em> from the server one week after it was first accessed.</p>
<p><em>ExpiresDefault &#8220;access plus 1 day&#8221;</em> tells the browser to reload default files from the server one day after it was accessed.</p>
        <p><center>&copy; MegaBurst.com - visit the <a href="http://www.megaburst.com/">high performance</a> web site building blog.</center></p>      ]]></content:encoded>
			<wfw:commentRss>http://www.megaburst.com/smart-caching-for-web-sites-and-blogs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
