<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:#000000"><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif">Hi Peter,</p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif"> </p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif">Here are my stats for this week: <a href="https://imgur.com/a/JloZ37h" style="color:rgb(5,99,193)">https://imgur.com/a/JloZ37h</a> . The Bypass is only because I was experimenting with some cache warmer scripts. This is primarily a static website.</p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif">Here’s my URL hit distribution: <a href="https://imgur.com/a/DRJUjPc" style="color:rgb(5,99,193)">https://imgur.com/a/DRJUjPc</a> </p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif">If three people are making the same request, they get identical content. No personalization. The pages are cached for 200 days and inactive in proxy_cache_path set to 60 days.</p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif"> </p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif">This is embarrassing but my CDNs are primarily $5 digital ocean machines across the web with this Nginx cache setup. The server response time averages at 0.29 seconds. Prior to doing my ghetto CDNing this was at 0.98 seconds. I am pretty proud that I have survived several Slashdot effects on the $5 machines serving cached content peaking at 2500 requests/second without any issues.</p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif"> </p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif">Since this is working well, I don’t want to do any layered caching, unless there is a compelling reason. </p></div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">- Quintin</div></div><br></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 12, 2018 at 4:32 PM Peter Booth via nginx <<a href="mailto:nginx@nginx.org">nginx@nginx.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space">Quintin,<div><br></div><div>Are most of your requests for dynamic or static content?</div><div>Are the requests clustered such that there is a lot of requests for a few (between 5 and 200, say) URLs?</div><div>If three different people make same request do they get personalized or identical content returned?</div><div>How long are the cached resources valid for?</div><div><br></div><div>I have seen layered caches deliver enormous benefit both in terms of performance and ensuring availability- which is usually</div><div>synonymous with “protecting teh backend.” That protection was most useful when, for example</div><div> I was working on a site that would get mentioned in a tv show at known time of the day every week.</div><div>nginx proxy_cache was invaluable at helping the site stay up and responsive when hit with enormous spikes of requests.</div><div><br></div><div>This is nuanced, subtle stuff though.</div><div><br></div><div>Is your site something that you can disclose publicly?</div><div><br></div><div><br></div><div>Peter</div><div><br></div><div><br><div><br><blockquote type="cite"><div>On 12 Sep 2018, at 7:23 PM, Quintin Par <<a href="mailto:quintinpar@gmail.com" target="_blank">quintinpar@gmail.com</a>> wrote:</div><br class="m_-2666203315270059691Apple-interchange-newline"><div><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif">Hi Lucas,</div><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif"> </p><div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif">The cache is pretty big and I want to limit unnecessary requests if I can. Cloudflare is in front of my machines and I pay for load balancing, firewall, Argo among others. So there is a cost per request.</div><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif"> </p><div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif">Admittedly I have a not so complex cache architecture. i.e. all cache machines in front of the origin and it has worked so far. This is also because I am not that great a programmer/admin :-)</div><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif"> </p><div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif">My optimization is not primarily around hits to the origin, but rather bandwidth and number of requests.</div><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:Calibri,sans-serif"> </p></div><br clear="all"><div><div dir="ltr" class="m_-2666203315270059691gmail_signature" data-smartmail="gmail_signature">- Quintin</div></div><br></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 12, 2018 at 1:06 PM Lucas Rolff <<a href="mailto:lucas@lucasrolff.com" target="_blank">lucas@lucasrolff.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Can I ask, why do you need to start with a warm cache directly? Sure it will lower the requests to the origin, but you could implement a secondary caching layer if you wanted to (using nginx), so you’d have your primary cache in let’s say 10 locations, let's say spread across 3 continents (US, EU, Asia), then you could have a second layer that consist of a smaller amount of locations (1 instance in each continent) - this way you'll warm up faster when you add new servers, and it won't really affect your origin server.<br>
<br>
It's a lot more clean also because you're able to use proxy_cache which is really what (in my opinion) you should use when you're building caching proxies.<br>
<br>
Generally I'd just slowly warm up new servers prior to putting them into production, get a list of top X files accessed, and loop over them to pull them in as a normal http request.<br>
<br>
There's plenty of decent solutions (some more complex than others), but there should really never be a reason to having to sync your cache across machines - even for new servers.<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a></blockquote></div>
_______________________________________________<br>nginx mailing list<br><a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br><a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a></div></blockquote></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://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a></blockquote></div>