<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Using Amazon&#8217;s CloudFront with Rails &amp; Paperclip</title>
	<atom:link href="http://blog.tristanmedia.com/2009/09/using-amazons-cloudfront-with-rails-and-paperclip/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tristanmedia.com/2009/09/using-amazons-cloudfront-with-rails-and-paperclip/</link>
	<description>One can never have enough scripting languages: Notes on Perl, PHP, and Ruby</description>
	<lastBuildDate>Thu, 08 Dec 2011 19:07:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
	<item>
		<title>By: Michael Hellein</title>
		<link>http://blog.tristanmedia.com/2009/09/using-amazons-cloudfront-with-rails-and-paperclip/comment-page-1/#comment-3099</link>
		<dc:creator>Michael Hellein</dc:creator>
		<pubDate>Thu, 08 Dec 2011 19:07:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tristanmedia.com/?p=56#comment-3099</guid>
		<description>Also, if you use rand in the Proc above, you&#039;ll be telling browsers to load the same file from different servers on each request, which is obviously not helpful for caching!</description>
		<content:encoded><![CDATA[<p>Also, if you use rand in the Proc above, you'll be telling browsers to load the same file from different servers on each request, which is obviously not helpful for caching!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Hellein</title>
		<link>http://blog.tristanmedia.com/2009/09/using-amazons-cloudfront-with-rails-and-paperclip/comment-page-1/#comment-3098</link>
		<dc:creator>Michael Hellein</dc:creator>
		<pubDate>Thu, 08 Dec 2011 18:47:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tristanmedia.com/?p=56#comment-3098</guid>
		<description>I haven&#039;t tried using Paperclip with Cloudfront yet, but I was also considering something like Mike Larkin is suggesting to get around the requests-per-domain bottleneck. However, I don&#039;t think his approach will work, as the string interpolation should only happen once when the model is loaded. (Or am I mistaken?)

Fortunately, :s3_host_alias also takes a Proc, so you could do:

:s3_host_alias =&gt; Proc.new { &quot;cdn#{rand(4)}.pixellent.com&quot; }

I also don&#039;t know if I would use rand, because you&#039;d get a more even distribution by repeatedly iterating from 0-n (where n is the number of domains). On some percentage of requests, rand will give us all the same domain, and then we&#039;d have no performance gain!</description>
		<content:encoded><![CDATA[<p>I haven't tried using Paperclip with Cloudfront yet, but I was also considering something like Mike Larkin is suggesting to get around the requests-per-domain bottleneck. However, I don't think his approach will work, as the string interpolation should only happen once when the model is loaded. (Or am I mistaken?)</p>
<p>Fortunately, :s3_host_alias also takes a Proc, so you could do:</p>
<p>:s3_host_alias =&gt; Proc.new { "cdn#{rand(4)}.pixellent.com" }</p>
<p>I also don't know if I would use rand, because you'd get a more even distribution by repeatedly iterating from 0-n (where n is the number of domains). On some percentage of requests, rand will give us all the same domain, and then we'd have no performance gain!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Colin Adams</title>
		<link>http://blog.tristanmedia.com/2009/09/using-amazons-cloudfront-with-rails-and-paperclip/comment-page-1/#comment-1462</link>
		<dc:creator>Colin Adams</dc:creator>
		<pubDate>Tue, 03 May 2011 00:53:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tristanmedia.com/?p=56#comment-1462</guid>
		<description>Thanks for this. I was looking for S3 stuff, but the &quot;:default_style =&gt; :original&quot; came in handy!</description>
		<content:encoded><![CDATA[<p>Thanks for this. I was looking for S3 stuff, but the ":default_style => :original" came in handy!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Rapin</title>
		<link>http://blog.tristanmedia.com/2009/09/using-amazons-cloudfront-with-rails-and-paperclip/comment-page-1/#comment-1216</link>
		<dc:creator>Dave Rapin</dc:creator>
		<pubDate>Fri, 04 Mar 2011 16:11:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tristanmedia.com/?p=56#comment-1216</guid>
		<description>Great writeup, thanks a lot. Especially found the timestamp based on *file* modified date useful for cloudfront.

I&#039;m using this for the next version (still in development) of my open source photographer portfolio (http://grokphoto.org)</description>
		<content:encoded><![CDATA[<p>Great writeup, thanks a lot. Especially found the timestamp based on *file* modified date useful for cloudfront.</p>
<p>I'm using this for the next version (still in development) of my open source photographer portfolio (<a href="http://grokphoto.org" rel="nofollow">http://grokphoto.org</a>)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Carleton</title>
		<link>http://blog.tristanmedia.com/2009/09/using-amazons-cloudfront-with-rails-and-paperclip/comment-page-1/#comment-1170</link>
		<dc:creator>Scott Carleton</dc:creator>
		<pubDate>Fri, 18 Feb 2011 01:49:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tristanmedia.com/?p=56#comment-1170</guid>
		<description>Barry,

Thanks for this post.  Exactly what I was looking for!</description>
		<content:encoded><![CDATA[<p>Barry,</p>
<p>Thanks for this post.  Exactly what I was looking for!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barry</title>
		<link>http://blog.tristanmedia.com/2009/09/using-amazons-cloudfront-with-rails-and-paperclip/comment-page-1/#comment-181</link>
		<dc:creator>Barry</dc:creator>
		<pubDate>Tue, 13 Apr 2010 21:32:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tristanmedia.com/?p=56#comment-181</guid>
		<description>Mike, I find just using the CDN is fast enough, and I want people&#039;s browsers to cache all of my assets.  Your approach means they might get a different URL for an asset every time they visit one of my pages, so that I end up paying more for outgoing bandwidth.</description>
		<content:encoded><![CDATA[<p>Mike, I find just using the CDN is fast enough, and I want people's browsers to cache all of my assets.  Your approach means they might get a different URL for an asset every time they visit one of my pages, so that I end up paying more for outgoing bandwidth.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Larkin</title>
		<link>http://blog.tristanmedia.com/2009/09/using-amazons-cloudfront-with-rails-and-paperclip/comment-page-1/#comment-180</link>
		<dc:creator>Mike Larkin</dc:creator>
		<pubDate>Tue, 13 Apr 2010 19:54:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tristanmedia.com/?p=56#comment-180</guid>
		<description>Excellent write up!  One thing I&#039;d suggest would be to use multiple CNAMEs to serve assets -- most browsers limit simultaneous connections to a subdomain to a max of 2, so if you use something like cnd0, cdn1, cdn2, cdn3, you can speed things up a bit:

:s3_host_alias =&gt; &quot;cdn#{rand(4)}.pixellent.com&quot;</description>
		<content:encoded><![CDATA[<p>Excellent write up!  One thing I'd suggest would be to use multiple CNAMEs to serve assets -- most browsers limit simultaneous connections to a subdomain to a max of 2, so if you use something like cnd0, cdn1, cdn2, cdn3, you can speed things up a bit:</p>
<p>:s3_host_alias =&gt; "cdn#{rand(4)}.pixellent.com"</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barry</title>
		<link>http://blog.tristanmedia.com/2009/09/using-amazons-cloudfront-with-rails-and-paperclip/comment-page-1/#comment-111</link>
		<dc:creator>Barry</dc:creator>
		<pubDate>Fri, 29 Jan 2010 18:13:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tristanmedia.com/?p=56#comment-111</guid>
		<description>Hello, Cameron.  It doesn&#039;t work that way.  The interpolation is using attachment.instance_read(:updated_at).to_i so it only changes if the file changes, not if anything else on the model changes.  The problem you describe only happens if you are relying on Model.updated_at for the interpolation.</description>
		<content:encoded><![CDATA[<p>Hello, Cameron.  It doesn't work that way.  The interpolation is using attachment.instance_read(:updated_at).to_i so it only changes if the file changes, not if anything else on the model changes.  The problem you describe only happens if you are relying on Model.updated_at for the interpolation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cameron Westland</title>
		<link>http://blog.tristanmedia.com/2009/09/using-amazons-cloudfront-with-rails-and-paperclip/comment-page-1/#comment-110</link>
		<dc:creator>Cameron Westland</dc:creator>
		<pubDate>Fri, 29 Jan 2010 16:14:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tristanmedia.com/?p=56#comment-110</guid>
		<description>Be careful with the updated_at interpolator if you&#039;re going to have any other attributes on the model. For instance. If you have :image and :name in the database. If you do Model#update_attribute(:name, &quot;New name&quot;) it will update your Interpolation for the attachment. It will not however update the file name on the server so you&#039;re path and the actual file will be out of sync.</description>
		<content:encoded><![CDATA[<p>Be careful with the updated_at interpolator if you're going to have any other attributes on the model. For instance. If you have :image and :name in the database. If you do Model#update_attribute(:name, "New name") it will update your Interpolation for the attachment. It will not however update the file name on the server so you're path and the actual file will be out of sync.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marco B</title>
		<link>http://blog.tristanmedia.com/2009/09/using-amazons-cloudfront-with-rails-and-paperclip/comment-page-1/#comment-60</link>
		<dc:creator>Marco B</dc:creator>
		<pubDate>Thu, 29 Oct 2009 08:33:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tristanmedia.com/?p=56#comment-60</guid>
		<description>Thanks for the post.

I know CloudFront has a 24hours delay to refresh its content if you update a file of yours into S3, so the &quot;change name&quot; does the trick (renaming a file is also the only way to be sure that browser don&#039;t use a locally cached version).

Nice way to implement this into paperclip, thanks again :)</description>
		<content:encoded><![CDATA[<p>Thanks for the post.</p>
<p>I know CloudFront has a 24hours delay to refresh its content if you update a file of yours into S3, so the "change name" does the trick (renaming a file is also the only way to be sure that browser don't use a locally cached version).</p>
<p>Nice way to implement this into paperclip, thanks again :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

