<?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/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>performance &#8211; Gareth Klose</title>
	<atom:link href="https://garethklose.com/tag/performance/feed" rel="self" type="application/rss+xml" />
	<link>https://garethklose.com</link>
	<description>writes about technology, television and travelling</description>
	<lastBuildDate>Thu, 23 Feb 2012 12:01:56 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.5</generator>
<site xmlns="com-wordpress:feed-additions:1">27787817</site>	<item>
		<title>Performance: still hard</title>
		<link>https://garethklose.com/2011/11/performance-still-hard</link>
		
		<dc:creator><![CDATA[gareth]]></dc:creator>
		<pubDate>Thu, 24 Nov 2011 14:25:47 +0000</pubDate>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[scaling]]></category>
		<guid isPermaLink="false">http://garethklose.com/?p=610</guid>

					<description><![CDATA[Performance is still hard: Artur Bergman of Fastly talks about what you're doing wrong.]]></description>
										<content:encoded><![CDATA[<p>I watched <a href="http://twitter.com/crucially">@crucially</a>’s video from the velocity conference, where once again it&#8217;s a good talk where he plays <a href="http://www.youtube.com/watch?v=oebqlzblfyo">the Grumpy Bastard</a> with aplomb. Soon, soon I promise, I will &#8220;Buy a Fucking SSD&#8221;.</p>
<p><strong>That&#8217;s Magic!</strong></p>
<p>If you don&#8217;t understand stuff, it&#8217;s magic. And if you&#8217;re relying on something that&#8217;s magic, your platform can disappear in a puff of smoke. This especially true of newer things &#8211; I don&#8217;t understand MySQL but it&#8217;s long in the tooth enough I can (mostly) trust it. Some of the newer NoSQL techs do not have that lineage&#8230;</p>
<p>Open Source allows you to get under the hood of all these things, to look behind the curtain and reverse-engineer what is going on. You invariably have to as the documentation is a TODO item. This means that when you do hit these extreme edge cases situations you can fix them, eventually.</p>
<p>But that&#8217;s only once you&#8217;ve really understood the problem. In black-box situations it&#8217;s all too easy to pull the levers you have until it seems the problem has gone away, but all you&#8217;ve done is masked, displaced, or deferred it. You have to understand the whole stack and not just &#8220;your bit&#8221;. (This reminded me a bit of a conversation with a friend who does network security, where decisions not to collect some data for &#8220;safety&#8221; actually made potential targets more obvious)</p>
<p><strong>There are no gremlins</strong></p>
<p>My favourite point was this: Computers are (mostly) deterministic.</p>
<p>We talk about bugs, issues, intermittent and transient faults &#8211; almost resigning ourselves to sometimes &#8220;things just happen&#8221;.</p>
<p>As Artur points out, computers are deterministic state machines, this randomness doesn&#8217;t really exist. Yes, the complex interplay of our interconnected systems can give the appearance of a random system, but that is just the appearance.</p>
<p>There is pattern in there, and when find it, you can fix it. How? Lots of monitoring, lots of measuring, and good old-fashioned investigation.</p>
<p><strong>Stop throwing boxes &amp; sharding at things</strong></p>
<p>The easy availability of horizontal scale-out makes us lazy and complacent: &#8220;we&#8217;ll just throw another amazon instance at the problem&#8221;. That can be a valid approach, but only when your existing instances are actually spending all of their time doing meaningful work and not stuck queuing on some random service. If you&#8217;re site is sluggish because of poor code, database performance or tuning, you&#8217;re not really solving the problems.</p>
<p>Latency is even more critical(<a href="http://code.google.com/speed/files/delayexp.pdf">Google PDF</a>), and scaling out a broken system may just let more people use it slowly &#8211; not make it faster.</p>
<p><strong>Post-Cloud Call to Arms?</strong></p>
<p>Scaling was hard: ordering servers took ages and it was all confusing. CDNs cost lots of money, were hard to use and only for the big boys.</p>
<p>Then &#8220;The Cloud&#8221; appeared: people like amazon and others made stuff cheaper and faster to get machines from. For a while we could ignore the complexity and just throw money at it.</p>
<p>But latency isn&#8217;t as simple as capacity, and we&#8217;re back to the situation that isn&#8217;t always about throwing more boxes into the battle.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">610</post-id>	</item>
		<item>
		<title>Caching WPtouch themes with WP Total Cache</title>
		<link>https://garethklose.com/2011/01/wptouch-and-wp-total-cache</link>
		
		<dc:creator><![CDATA[gareth]]></dc:creator>
		<pubDate>Sat, 01 Jan 2011 19:23:49 +0000</pubDate>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[W3 Total Cache]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">http://garethklose.com/?p=259</guid>

					<description><![CDATA[How to make W3 Turbo Cache play more cleverly alongside the WP Touch iPhone interface plugin.]]></description>
										<content:encoded><![CDATA[<p><strong>THE COOKIE NAME HAS CHANGED, PLEASE ADD wptouch_switch_toggle INSTEAD</strong></p>
<p>I really like <a href="http://wordpress.org">WordPress</a>. I like the interface and the available plug-ins. It&#8217;s impressive how much you can do without coding, just configuring things. I use <a href="http://wordpress.org/extend/plugins/wptouch/">WPTouch</a> to provide an iPhone/mobile devices theme. However, as a PHP application WordPress famously doesn&#8217;t scale to being Fireballed, Slashdotted, Dugg when you&#8217;re running on a small server. Even if you&#8217;re not too worried about being popular, by the time you&#8217;ve installed a few plugins, your site might be feeling a bit sluggish.</p>
<p>Like anyone with the naive belief I could write just such a post, but sensible enough to know it&#8217;ll too late to fix if I do, I&#8217;ve always had a caching plugin installed. Firstly it was <a href="http://wordpress.org/extend/plugins/wp-super-cache/">WP Supercache</a>, but now I use <a href="http://wordpress.org/extend/plugins/w3-total-cache/">WP Total Cache</a> (W3TC).</p>
<p>Short of using a caching front-end server such as <a href="http://varnish-cache.org">Varnish</a> (which is my next side project), WP Supercache/WPTC&#8217;s &#8220;disk (enhanced)&#8221; Page-Caching is the fastest way to serve your pages, because it&#8217;s done an Apache level. PHP isn&#8217;t loaded, databases aren&#8217;t queried, static files are served off disk.</p>
<p>W3TC also does JS/CSS minification, compression, and CDN distribution. These also can accelerate your site, but again won&#8217;t always work with all the plug-ins that you have installed. I would suggest you start off with basic caching, enable modules selectively, and test many times.</p>
<p>Caching, and things like themes don&#8217;t really co-exist that well, especially if you try and share the same URL for one bit of content rather than having the <em>m.mysite.com</em> thing. The normal install guides for WPtouch and caching plug-ins involve preventing page caching for all mobile user-agents. While it works, it&#8217;s not the most efficient use of your server, especially given people clicking on links from Twitter clients on mobile devices may prove part of the onslaught.</p>
<p>Rather than preventing all mobile traffic being cached, what you can do instead is request that pages are cached until &#8220;wptouch_toggle_cookie&#8221; is set. This is the cookie which allows users to jump back to the desktop view of the site on a mobile device. In this way you&#8217;re caching the first hit to your site, and all hits until they change theme. That should cover a lot of visitors.</p>
<p>You have two parallel caching silos: The normal site, and the mobile site. You direct to the correct one of these based on user-agent, and when the user manually flips, the cookie is set, and you&#8217;re no longer doing page level caching. You still getting the benefit of the Database and Object caching that WP Total Cache does, but it&#8217;s much slower. If you are lucky enough to be suddenly very popular, hopefully the vastly reduced load of the majority of users should mean that even non-cached users get the right content, and not a 500 error.</p>
<p><em>I&#8217;m not going to cover installing W3TC because the plugin itself covers this quite well, and other places. If you&#8217;re on Debian I&#8217;ll flag up that you can install all the additional libraries like APC/memcached for caching, Curl for CDN uploads etc from packages, and avoid compiling anything.</em></p>
<p><strong>WARNING:</strong> this is potentially brittle. If the cookie name changes you will be leaving mobile users stranded in the mobile interface, with a &#8220;turn mobile off&#8221; button that doesn&#8217;t work. That said, if you have any mismatches between user-agents in the variety of lists they can appear, that also can cause problems. Check this all works after you update any of WordPress, WP Touch, WP Total Cache.</p>
<h3>How to do it</h3>
<p><strong>WARNING: </strong>When you edit this group, WP Turbo Cache is editing .htaccess files. It doesn&#8217;t not escape them automatically, it&#8217;s VERY easy to break your website, including your admin interface&#8230; Don&#8217;t attempt to do this without file access, access to apache error logs, and ideally SSH access. Backup before you start: Your WordPress files, your wordpress database and also the WPTC config (there&#8217;s a download button on the first page).</p>
<p>To enable this hack you&#8217;ll have to do two things, one create the user agent group that will get the mobile touch theme.</p>
<h3>1) Define the WP Touch User Agent Group</h3>
<p>What we&#8217;re doing here is defining a list of the agents that should be redirected to the alternative cache pool, that shows the mobile theme.</p>
<p>My current WP Touch plugin claims on the admin interface to support &#8220;<em>Android, CUPCAKE, bada, blackberry 9800, blackberry9500, blackberry9520, blackberry9530, blackberry9550, dream, iPhone, iPod, incognito, s8000, webOS, webmate</em>&#8221;</p>
<p>The list in W3 Total Cache must match what WPTouch expects, if it doesn&#8217;t then you could well have mobile served to desktops, and vice versa. The nicest way of doing this would be if your mobile theme was in fact a standalone theme, as W3TC can serve different themes to different User Agent Groups, and you&#8217;d only be doing the switch once. This isn&#8217;t possible though.</p>
<p>Select &#8220;User Agent Groups&#8221; from the dropdown in the W3TC admin panel</p>
<p>Copying, pasting and editing from the existing User Agent groups, I created a group with the following. When you save this page, you can easily cause 500 errors on your site, until you manually edit/remove various .htaccess files in your website directory. If this happens you&#8217;ll need to read the apache error log to track down the offending files.</p>
<pre>android
blackberry9500
blackberry9520
blackberry9530
blackberry9550
blackberry9800
cupcake
dream
incognito
iphone
ipod
samsung\-s8000
webos
webmate</pre>
<p><a href="https://cdn.garethklose.com/wp-content/uploads/2011/01/User-Agent-Groups-W3-Total-Cache-‹-Gareth-Klose-—-WordPress.jpg"><img fetchpriority="high" decoding="async" data-attachment-id="268" data-permalink="https://garethklose.com/2011/01/wptouch-and-wp-total-cache/user-agent-groups-w3-total-cache-%e2%80%b9-gareth-klose-%e2%80%94-wordpress" data-orig-file="https://cdn.garethklose.com/wp-content/uploads/2011/01/User-Agent-Groups-W3-Total-Cache-‹-Gareth-Klose-—-WordPress.jpg" data-orig-size="765,610" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="WPTC &#8211; User Agent Groups Screen" data-image-description="" data-image-caption="" data-medium-file="https://cdn.garethklose.com/wp-content/uploads/2011/01/User-Agent-Groups-W3-Total-Cache-‹-Gareth-Klose-—-WordPress-300x239.jpg" data-large-file="https://cdn.garethklose.com/wp-content/uploads/2011/01/User-Agent-Groups-W3-Total-Cache-‹-Gareth-Klose-—-WordPress.jpg" class="aligncenter size-medium wp-image-268" title="WPTC - User Agent Groups Screen" src="https://cdn.garethklose.com/wp-content/uploads/2011/01/User-Agent-Groups-W3-Total-Cache-‹-Gareth-Klose-—-WordPress-300x239.jpg" alt="" width="300" height="239" srcset="https://cdn.garethklose.com/wp-content/uploads/2011/01/User-Agent-Groups-W3-Total-Cache-‹-Gareth-Klose-—-WordPress-300x239.jpg 300w, https://cdn.garethklose.com/wp-content/uploads/2011/01/User-Agent-Groups-W3-Total-Cache-‹-Gareth-Klose-—-WordPress-150x119.jpg 150w, https://cdn.garethklose.com/wp-content/uploads/2011/01/User-Agent-Groups-W3-Total-Cache-‹-Gareth-Klose-—-WordPress.jpg 765w" sizes="(max-width: 300px) 85vw, 300px" /></a></p>
<p>Delete the other groups that WP Total Cache has put in place by default. That keeps the set of mod_rewrite rules used by Apache smaller.</p>
<h3>2) Add the cookie exemption</h3>
<p>On the Page Cache Settings, add &#8220;wptouch_switch_toggle&#8221; (which used to be <del datetime="2011-10-28T19:31:12+00:00"> &#8220;wptouch_switch_cookie&#8221;</del>) to the rejected cookies list.</p>
<p><a href="https://cdn.garethklose.com/wp-content/uploads/2011/01/Page-Cache-W3-Total-Cache-‹-Gareth-Klose-—-WordPress.jpg"><img decoding="async" data-attachment-id="272" data-permalink="https://garethklose.com/2011/01/wptouch-and-wp-total-cache/page-cache-w3-total-cache-%e2%80%b9-gareth-klose-%e2%80%94-wordpress" data-orig-file="https://cdn.garethklose.com/wp-content/uploads/2011/01/Page-Cache-W3-Total-Cache-‹-Gareth-Klose-—-WordPress.jpg" data-orig-size="672,383" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="W3TC Page Cache Settings" data-image-description="" data-image-caption="" data-medium-file="https://cdn.garethklose.com/wp-content/uploads/2011/01/Page-Cache-W3-Total-Cache-‹-Gareth-Klose-—-WordPress-300x170.jpg" data-large-file="https://cdn.garethklose.com/wp-content/uploads/2011/01/Page-Cache-W3-Total-Cache-‹-Gareth-Klose-—-WordPress.jpg" class="aligncenter size-medium wp-image-272" title="W3TC Page Cache Settings" src="https://cdn.garethklose.com/wp-content/uploads/2011/01/Page-Cache-W3-Total-Cache-‹-Gareth-Klose-—-WordPress-300x170.jpg" alt="" width="300" height="170" srcset="https://cdn.garethklose.com/wp-content/uploads/2011/01/Page-Cache-W3-Total-Cache-‹-Gareth-Klose-—-WordPress-300x170.jpg 300w, https://cdn.garethklose.com/wp-content/uploads/2011/01/Page-Cache-W3-Total-Cache-‹-Gareth-Klose-—-WordPress-150x85.jpg 150w, https://cdn.garethklose.com/wp-content/uploads/2011/01/Page-Cache-W3-Total-Cache-‹-Gareth-Klose-—-WordPress.jpg 672w" sizes="(max-width: 300px) 85vw, 300px" /></a></p>
<h3>Save, Deploy &amp; Flush all the caches and test</h3>
<p>After you&#8217;ve done that, you&#8217;re good to go. Apply the config, purge all your caches, then try to access the site on a &#8220;clean&#8221; desktop browser. Verify that you&#8217;re getting the desktop version, and the comments in the source show you&#8217;re being page-cached. (compare to a browser where you&#8217;re logged in where you should see something about &#8216;cookie rejected&#8217;)</p>
<p>The try on your nearest iPod/iPhone etc. You may will want to install a Javascript source viewer to debug and verify you&#8217;re indeed getting a cached copy, then comparing what happens as soon as you turn the mobile version off. You should the desktop site, with the &#8220;change to mobile&#8221; button. Expect to do a lot of user-agent faking, and cookie clearing to verify you&#8217;re really seeing what you should be getting.</p>
<p>Finally, hit reload lots, and if you&#8217;re cached, your server shouldn&#8217;t really notice and speed should be quite fast.</p>
<p>At this point you&#8217;ll also want to ask a few friends just to see what they are seeing on the site, just to check for consistency.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">259</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/

Object Caching 0/131 objects using APC
Page Caching using Disk: Enhanced 
Content Delivery Network via Amazon Web Services: CloudFront: cdn.garethklose.com
Minified using Disk
Database Caching using APC (Request-wide modification query)

Served from: garethklose.com @ 2026-07-18 03:28:31 by W3 Total Cache
-->