<?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:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:rawvoice="http://www.rawvoice.com/rawvoiceRssModule/"
>

<channel>
	<title>Solution Hacker &#187; squid</title>
	<atom:link href="http://www.solutionhacker.com/tag/squid/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.solutionhacker.com</link>
	<description>This blog provides solutions for enterpreneurs!</description>
	<lastBuildDate>Sun, 05 Feb 2012 00:45:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=160</generator>
<!-- podcast_generator="Blubrry PowerPress/2.0.4" -->
	<itunes:summary>This blog provides solutions for enterpreneurs!</itunes:summary>
	<itunes:author>Solution Hacker</itunes:author>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://www.solutionhacker.com/wp-content/plugins/powerpress/itunes_default.jpg" />
	<itunes:subtitle>This blog provides solutions for enterpreneurs!</itunes:subtitle>
	<image>
		<title>Solution Hacker &#187; squid</title>
		<url>http://www.solutionhacker.com/wp-content/plugins/powerpress/rss_default.jpg</url>
		<link>http://www.solutionhacker.com</link>
	</image>
		<item>
		<title>Speed up your website via caching</title>
		<link>http://www.solutionhacker.com/uncategorized/webcaching/</link>
		<comments>http://www.solutionhacker.com/uncategorized/webcaching/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 19:31:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[6. Uncategorized]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[cdn]]></category>
		<category><![CDATA[coral]]></category>
		<category><![CDATA[jcs]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[squid]]></category>

		<guid isPermaLink="false">http://www.solutionhacker.com/?p=207</guid>
		<description><![CDATA[<h2>Introduction</h2>
<p>Caching is a crucial performance tuning strategy, especially your system has high read to write ratio. You can perform caching strategy at different levels from <strong>client browser cache</strong> all the way to <strong>disk cache</strong> at server side. Lets take a brief look at where we can cache based on the invocation path for a request to be fulfilled:</p>
<ol>
    <li>Client browser cache</li>
    <li><strong>CDN network</strong>
    <ul>
        <li>A <strong>CDN </strong>is a network, like <strong>Akamai</strong>, where a web site such as JustProposed.com can offload high-bandwidth static files like photos and videos to another network, so that my web site doesn't need to have such huge bandwidth to run. Since bandwidth is a major expense, especially as we grow or when we get <strong>slashdotted </strong>(in which case we run out of bandwidth), a CDN has looked interesting. However, Akamai is too expensive for us to use. So, we will go for the free network, <a href="http://www.coralcdn.org/">Coral CDN</a>.</li>
        <li>Apart from the bandwidth, JustProposed.com has lots of non-USA users who sometimes find my site slow to use. So, CDN network gives us proximity advantages.</li>
        <li>To use Coral CDN, you simply append <span style="color: rgb(255, 0, 0);">nydu.net:8080</span> to the end of the hostname in the URL of your expensive resources. For example, <strong>http://www.justproposed.com/raydoris/myphoto.jpg</strong> to <strong>http://www.justproposed.com.<span style="color: rgb(255, 0, 0);">nydu.net:8080</span>/raydoris/myphoto.jpg</strong></li>
        <li>Coral looks great, the only problem I have with it is that it's running on a high port, so that people behind proxy servers that don't automatically support http over anything bug port 80 will have problems. To use Coral, follow this <a href="http://wiki.coralcdn.org/wiki.php?n=Main.Servers">instruction</a>.</li>
    </ul>
    </li>
    <li><strong>Reverse proxy server</strong> and content accelerator - Squid<span style="display: none;" id="1232960301723S">&#160; </span>
    <ul>
        <li>&#160;Why not use Apache as reverse proxy instead of putting Squid in front of Apache? <a href="http://abdussamad.com/archives/121-Squid-reverse-proxy-Apache-on-centos-4.5.html">Here</a> are some of the benefits of this setup. The main reason is that Apache spawns out a new process per request that eats up lots of resources.</li>
        <li>&#160;</li>
    </ul>
    </li>
</ol>
<p>&#160;<span style="display: none;" id="1232960273972S">&#160;</span><img src="http://www.redhat.com/docs/manuals/cms/rhea-dpg-cms-en-6.1/figs/ccm_hw_arch.png" style="width: 523px; height: 234px;" alt="" /></p>
<p>There are several things that you need to look at when you go for caching approach:</p>
<ol>
    <li><strong>What to cache?</strong> The data used by most web applications varies in its           dynamicity, from completely static to always changing at every           request.  Everything that has some degree of stability can be           cached. However, I always pick the ones that are most frequently access and/or expensive to compute and retrieve to cache because of the limited resource (ie. memory).</li>
</ol>
<h2>Application level caching (for J2EE)</h2>
<p><u><strong>JCS - Java Caching System</strong></u></p>
<p><img style="width: 551px; height: 356px;" src="http://www.solutionhacker.com/wp-content/uploads/image/caching.JPG" alt="" /></p>
<ol>
    <li><strong>Configuration</strong>
    <ul>
        <li>To understand the power of <a href="http://jakarta.apache.org/jcs/index.html">JCS</a>, the best way is to look at its configuration file. To find out what is each configurable parameter does, take a look at this <a href="http://www.informit.com/guides/content.aspx?g=java&#38;seqNum=438">article</a>.</li>
    </ul>
    </li>
    <li><strong>Integrate with Spring</strong>
    <ul>
        <li>To use JCS with Spring, take a look at this <a href="http://gleichmann.wordpress.com/2008/04/29/pragmatic-caching-a-simple-cache-configuration-model-for-spring/">article</a>. It talks about how to create a wrapper or Interceptor for your DAO and inject it to your service for caching purpose. To implement cache as an aspect with full control of what and how to cache, it doesn't use the declarative Spring module caching approach. Regular dependency injection can do the trick!</li>
    </ul>
    </li>
    <li><strong>Distributed caching</strong>
    <ul>
        <li>JCS is a front-tier cache that can be configured to maintain         consistency across multiple servers by using a <strong>centralized         remote server</strong> <strong>(client-server)</strong> or by <strong>lateral distribution (peer-to-peer)</strong> <strong>of cache updates.</strong>&#160;</li>
    </ul>
    </li>
</ol>
<h2>Reference</h2>
<ol>
    <li><a href="http://www.mysqlperformanceblog.com/2006/05/21/speedup-your-lamp-stack-with-lighttpd/">Speed up your LAMP stack with lighhttpd</a></li>
    <li><a href="http://kevin.vanzonneveld.net/techblog/article/install_squid_apache_on_1_server/">Squid and Apache on the same server</a> - have squid listened on port 80 and apache listened on port 8080</li>
    <li><a href="http://www.visolve.com/squid/squid24s1/contents.php">Squid configuration variable </a></li>
</ol>
<p>&#160;</p>]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Caching is a crucial performance tuning strategy, especially your system has high read to write ratio. You can perform caching strategy at different levels from <strong>client browser cache</strong> all the way to <strong>disk cache</strong> at server side. Lets take a brief look at where we can cache based on the invocation path for a request to be fulfilled:</p>
<ol>
<li>Client browser cache</li>
<li><strong>CDN network</strong>
<ul>
<li>A <strong>CDN </strong>is a network, like <strong>Akamai</strong>, where a web site such as JustProposed.com can offload high-bandwidth static files like photos and videos to another network, so that my web site doesn&#8217;t need to have such huge bandwidth to run. Since bandwidth is a major expense, especially as we grow or when we get <strong>slashdotted </strong>(in which case we run out of bandwidth), a CDN has looked interesting. However, Akamai is too expensive for us to use. So, we will go for the free network, <a href="http://www.coralcdn.org/">Coral CDN</a>.</li>
<li>Apart from the bandwidth, JustProposed.com has lots of non-USA users who sometimes find my site slow to use. So, CDN network gives us proximity advantages.</li>
<li>To use Coral CDN, you simply append <span style="color: rgb(255, 0, 0);">nydu.net:8080</span> to the end of the hostname in the URL of your expensive resources. For example, <strong>http://www.justproposed.com/raydoris/myphoto.jpg</strong> to <strong>http://www.justproposed.com.<span style="color: rgb(255, 0, 0);">nydu.net:8080</span>/raydoris/myphoto.jpg</strong></li>
<li>Coral looks great, the only problem I have with it is that it&#8217;s running on a high port, so that people behind proxy servers that don&#8217;t automatically support http over anything bug port 80 will have problems. To use Coral, follow this <a href="http://wiki.coralcdn.org/wiki.php?n=Main.Servers">instruction</a>.</li>
</ul>
</li>
<li><strong>Reverse proxy server</strong> and content accelerator &#8211; Squid<span style="display: none;" id="1232960301723S">&#160; </span>
<ul>
<li>&#160;Why not use Apache as reverse proxy instead of putting Squid in front of Apache? <a href="http://abdussamad.com/archives/121-Squid-reverse-proxy-Apache-on-centos-4.5.html">Here</a> are some of the benefits of this setup. The main reason is that Apache spawns out a new process per request that eats up lots of resources.</li>
<li>&#160;</li>
</ul>
</li>
</ol>
<p>&#160;<span style="display: none;" id="1232960273972S">&#160;</span><img src="http://www.redhat.com/docs/manuals/cms/rhea-dpg-cms-en-6.1/figs/ccm_hw_arch.png" style="width: 523px; height: 234px;" alt="" /></p>
<p>There are several things that you need to look at when you go for caching approach:</p>
<ol>
<li><strong>What to cache?</strong> The data used by most web applications varies in its           dynamicity, from completely static to always changing at every           request.  Everything that has some degree of stability can be           cached. However, I always pick the ones that are most frequently access and/or expensive to compute and retrieve to cache because of the limited resource (ie. memory).</li>
</ol>
<h2>Application level caching (for J2EE)</h2>
<p><u><strong>JCS &#8211; Java Caching System</strong></u></p>
<p><img style="width: 551px; height: 356px;" src="http://www.solutionhacker.com/wp-content/uploads/image/caching.JPG" alt="" /></p>
<ol>
<li><strong>Configuration</strong>
<ul>
<li>To understand the power of <a href="http://jakarta.apache.org/jcs/index.html">JCS</a>, the best way is to look at its configuration file. To find out what is each configurable parameter does, take a look at this <a href="http://www.informit.com/guides/content.aspx?g=java&amp;seqNum=438">article</a>.</li>
</ul>
</li>
<li><strong>Integrate with Spring</strong>
<ul>
<li>To use JCS with Spring, take a look at this <a href="http://gleichmann.wordpress.com/2008/04/29/pragmatic-caching-a-simple-cache-configuration-model-for-spring/">article</a>. It talks about how to create a wrapper or Interceptor for your DAO and inject it to your service for caching purpose. To implement cache as an aspect with full control of what and how to cache, it doesn&#8217;t use the declarative Spring module caching approach. Regular dependency injection can do the trick!</li>
</ul>
</li>
<li><strong>Distributed caching</strong>
<ul>
<li>JCS is a front-tier cache that can be configured to maintain         consistency across multiple servers by using a <strong>centralized         remote server</strong> <strong>(client-server)</strong> or by <strong>lateral distribution (peer-to-peer)</strong> <strong>of cache updates.</strong>&#160;</li>
</ul>
</li>
</ol>
<h2>Reference</h2>
<ol>
<li><a href="http://www.mysqlperformanceblog.com/2006/05/21/speedup-your-lamp-stack-with-lighttpd/">Speed up your LAMP stack with lighhttpd</a></li>
<li><a href="http://kevin.vanzonneveld.net/techblog/article/install_squid_apache_on_1_server/">Squid and Apache on the same server</a> &#8211; have squid listened on port 80 and apache listened on port 8080</li>
<li><a href="http://www.visolve.com/squid/squid24s1/contents.php">Squid configuration variable </a></li>
</ol>
<p>&#160;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutionhacker.com/uncategorized/webcaching/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

