Thanks for the details, once I realized the difference, going directly to the CDN is the whole point. <div><br></div><div>Rackspace has an interesting product which combines storage + CDN so for us that kind solution may work well, but we&#39;re still exploring.</div>
<div><br></div><div>Thanks<br><br><div class="gmail_quote">On Sat, Jan 8, 2011 at 9:11 AM, Nicholas Tang <span dir="ltr">&lt;<a href="mailto:nicholas.tang@livestream.com">nicholas.tang@livestream.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Sorry, someone asked me for more details off list; I was sitting down to relax at the time and didn&#39;t feel like elaborating at that moment.  ;)<div>
<br></div><div>So:<br><div><br></div><div>One of the major advantages of a CDN is the fact that they have a distributed infrastructure over multiple geographies; when someone does a DNS lookup it generally makes a best-effort attempt to direct them at the infrastructure closest to them - and removes the need to connect to your infrastructure at all (for that request).  So it acts as a cache, offloading work from your infrastructure, and it optimizes the end-user experience by (hopefully) presenting them w/ a local place to make requests from, reducing network delays.<div>

<br></div><div>In terms of total end-user time, it&#39;s often negligible for the 2nd path, but it does mean another open network connection.  And if the end-user is on a network with poor connectivity to your infrastructure, it means that they have to first traverse that bad network to yours, get the response back, and then go ahead and make a 2nd request to the CDN after that.  If it takes 100 ms for them to go to your server and get a response, that&#39;s 100 ms of delay for each request.  And if the request is for something like css or javascript or static html that could potentially refer to other external resources (therefore starting new requests), it can chain or stack or whatever term you prefer.</div>

<div><br></div><div>Example:</div><div><br></div><div>static html page refers to css refers to image</div><div><br></div><div>If all of them are on the CDN and directly referred to, then your load time is:</div><div>(dns lookup to cdn + round-trip for html + round-trip for css + round-trip for image).</div>

<div><br></div><div>If they aren&#39;t and are just redirected, then your load time is:</div><div>(dns lookup to nginx + round-trip to nginx + dns lookup to cdn + round-trip for html + round-trip to nginx + round-trip for css + round-trip to nginx + round-trip for image)</div>

<div><br></div><div>(That&#39;s simplified, and can in many cases be worse than that.  Don&#39;t forget that if the content isn&#39;t cached, the CDN itself still has to make requests back to your infrastructure the first time to get the objects into their cache... so add 3 more round-trips to nginx, and these are for content, not just redirects. :) )</div>

<div><br></div><div><br></div><div>Factor in the fact that now nginx is also now maintaining open connections, your network is sustaining extra traffic (which you&#39;re probably paying for), and the fact that the end-user is now subject to additional delays and work on their client side to get to your page, and it&#39;s generally an easy choice.</div>

<div><br></div><div>If you just want to temporarily enable a CDN for something selectively and are testing or aren&#39;t as concerned w/ those factors, sure, it&#39;s not a big deal.  But, as I mentioned, it does remove a lot of the benefit of the CDN in the first place.</div>

<div><br></div><div>Again, there&#39;s a lot more to it than that, but for a 30 second primer I think that&#39;ll do.  (Good references: play w/ firebug and watch what your site does, look into things like yslow or google pagespeed, check out <a href="http://webpagetest.org" target="_blank">webpagetest.org</a>&#39;s reports, etc.)</div>
<div><div></div><div class="h5">
<div><br></div><div>Nicholas</div><div><br></div><div> <span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">

<span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">

<span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">

<div><br><table style="border-top:1px dashed rgb(204, 204, 204);border-bottom:1px dashed rgb(204, 204, 204);width:585px" cellpadding="5" width="100%"><tbody><tr><td><div style="font-family:&#39;Lucida Grande&#39;,Verdana,Arial,sans-serif;font-size:9px;color:rgb(153, 153, 153);line-height:9pt">

<div style="float:left"><strong style="color:rgb(255, 0, 0)">Nicholas Tang</strong><strong style="color:rgb(85, 85, 85);margin-left:3px;margin-right:3px">:</strong></div><div style="float:left;font-weight:bold;color:rgb(85, 85, 85);margin-right:3px">

VP, Dev Ops<br></div><br><div style="float:left;margin-right:5px"><a href="mailto:nicholas.tang@livestream.com" title="Email me" style="color:rgb(153, 153, 153);text-decoration:none" target="_blank">nicholas.tang@livestream.com</a></div>

<div style="float:left;font-weight:bold;color:rgb(204, 204, 204);margin-right:5px">|</div><div style="float:left;margin-right:5px">t: +1 (646) 495 9707</div><div style="float:left;font-weight:bold;color:rgb(204, 204, 204);margin-right:5px">

|</div><div style="float:left;margin-right:5px">m: +1 (347) 410 6066<br></div><div style="float:left;font-weight:bold;color:rgb(204, 204, 204);margin-right:3px">|</div><div style="float:left">111 8th Avenue, Floor 15, New York, NY 10011</div>

</div></td><td style="width:100px" width="100px"><a href="http://www.livestream.com/" title="Visit livestream.com" target="_blank"><img alt="www.livestream.com" border="0" height="25" width="100"></a></td>
</tr></tbody></table></div></div></span></div></span></div></span> </div><br>
<br><br><div class="gmail_quote">On Fri, Jan 7, 2011 at 9:11 PM, Nicholas Tang <span dir="ltr">&lt;<a href="mailto:nicholas.tang@livestream.com" target="_blank">nicholas.tang@livestream.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

The 2nd option defeats most of the purpose of a CDN.<div><br></div><div>Nicholas<br clear="all"><div> <span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">


<span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">


<span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">


<div><br><table style="border-top:1px dashed rgb(204, 204, 204);border-bottom:1px dashed rgb(204, 204, 204);width:585px" cellpadding="5" width="100%"><tbody><tr><td><div style="font-family:&#39;Lucida Grande&#39;,Verdana,Arial,sans-serif;font-size:9px;color:rgb(153, 153, 153);line-height:9pt">


<div style="float:left"><strong style="color:rgb(255, 0, 0)">Nicholas Tang</strong><strong style="color:rgb(85, 85, 85);margin-left:3px;margin-right:3px">:</strong></div><div style="float:left;font-weight:bold;color:rgb(85, 85, 85);margin-right:3px">


VP, Dev Ops<br></div><br><div style="float:left;margin-right:5px"><a href="mailto:nicholas.tang@livestream.com" title="Email me" style="color:rgb(153, 153, 153);text-decoration:none" target="_blank">nicholas.tang@livestream.com</a></div>


<div style="float:left;font-weight:bold;color:rgb(204, 204, 204);margin-right:5px">|</div><div style="float:left;margin-right:5px">t: +1 (646) 495 9707</div><div style="float:left;font-weight:bold;color:rgb(204, 204, 204);margin-right:5px">


|</div><div style="float:left;margin-right:5px">m: +1 (347) 410 6066<br></div><div style="float:left;font-weight:bold;color:rgb(204, 204, 204);margin-right:3px">|</div><div style="float:left">111 8th Avenue, Floor 15, New York, NY 10011</div>


</div></td><td style="width:100px" width="100px"><a href="http://www.livestream.com/" title="Visit livestream.com" target="_blank"><img alt="www.livestream.com" border="0" height="25" width="100"></a></td>

</tr></tbody></table></div></div></span></div></span></div></span> </div><br>
<br><br><div class="gmail_quote"><div><div></div><div>On Fri, Jan 7, 2011 at 8:36 PM, Ilan Berkner <span dir="ltr">&lt;<a href="mailto:iberkner@gmail.com" target="_blank">iberkner@gmail.com</a>&gt;</span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>
<div>At this time we&#39;re delivering static content, in particular, audio files ~5K in size directly through our server, for a number of reasons, we&#39;re looking at moving delivery of these files to a remote storage / CDN facility.</div>



<div><br></div><div>Question re. URL requests for these files.  Currently, these file are served through a request like this: <a href="http://www.ourdomain.com/sounds/a/alpha.mp3" target="_blank">http://www.ourdomain.com/sounds/a/alpha.mp3</a>.  If we switched to a remote storage / CDN solution, the URL of course would change to something else.  There are 2 options ( I think ):</div>



<div><br></div><div>1. Modify the application code to make the the call directly to the new URL.</div><div><br></div><div>2. Instruct Nginx through a location clause to redirect such traffic to another URL, for example:</div>



<div><br></div><div>location /sounds/*.mp3 {</div><div>  rewrite <a href="http://www.cdn.com/$1" target="_blank">http://www.cdn.com/$1</a> ...</div><div>}</div><div><br></div><div>Is there a preferred way or does it matter?  I guess the first option would probably be preferred as it further reduces the work load done by the server, even as simple as parsing the URL...  Any thoughts / suggestions would be appreciated.</div>



<div><br></div><div>Also, does anyone have a recommendation / experience with any particular remote storage / CDN such as Rackspace CloudFile, Amazon S3, Limelight, CacheFly, etc?</div><div><br></div><div>Thanks</div>
<br></div></div>_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://nginx.org/mailman/listinfo/nginx" target="_blank">http://nginx.org/mailman/listinfo/nginx</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div></div></div>
<br>_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://nginx.org/mailman/listinfo/nginx" target="_blank">http://nginx.org/mailman/listinfo/nginx</a><br>
<br></blockquote></div><br></div>