Re: NGINX stale-while-revalidate cluster

2017-07-10 Thread Maxim Dounin
Hello! On Sat, Jul 08, 2017 at 10:28:54PM +0200, Joan Tomàs i Buliart wrote: > Hi Peter, > > > yes, it's true. I will try to explain our problem better. > > We provide a mobile solution for newspaper and media groups. With this > kind of partners, it is easy to have a peak of traffic. We pref

Re: NGINX stale-while-revalidate cluster

2017-07-09 Thread Peter Booth
stale-while-revalidate is awesome, but it might not be the optimal tool here. It came out of Yahoo!, the sixth largest website in the world, who used a small number of caching proxies. In their context most content is served hot from cache. A cloud deployment typically means a larger number

Re: NGINX stale-while-revalidate cluster

2017-07-08 Thread Joan Tomàs i Buliart
Hi Peter, yes, it's true. I will try to explain our problem better. We provide a mobile solution for newspaper and media groups. With this kind of partners, it is easy to have a peak of traffic. We prefer to give stale content (1 or 2 minutes stale content, not more) instead of block the req

Re: NGINX stale-while-revalidate cluster

2017-07-08 Thread Peter Booth
Perhaps it would help if, rather than focus on the specific solution that you are wanting, you instead explained your specific problem and business context? What is driving your architecture? Is it about protecting a backend that doesn't scale or more about reducing latencies? How many differen

Re: NGINX stale-while-revalidate cluster

2017-07-08 Thread Joan Tomàs i Buliart
Thanks Owen! We considered all the options on these 2 documents but, on our environment in which is important to use stale-while-revalidate, all of them have, at least, one of these drawbacks: or it adds a layer in the fast path to the content or it can't guarantee that one request on a stale

Re: NGINX stale-while-revalidate cluster

2017-07-07 Thread Owen Garrett
There are a couple of options described here that you could consider if you want to share your cache between NGINX instances: https://www.nginx.com/blog/shared-caches-nginx-plus-cache-clusters-part-1/ describes a shard

Re: NGINX stale-while-revalidate cluster

2017-07-07 Thread Peter Booth
You could do that but it would be bad. Nginx' great performance is based on serving files from a local Fisk and the behavior of a Linux page cache. If you serve from a shared (nfs) filsystem then every request is slower. You shouldn't slow down the common case just to increase cache hit rate. S

Re: NGINX stale-while-revalidate cluster

2017-07-07 Thread Frank Dias
Have you thought about using a shared file system for the cache. This way all the nginx 's are looking at the same cached content. On Jul 7, 2017 5:30 AM, Joan Tomàs i Buliart wrote: Hi Lucas On 07/07/17 12:12, Lucas Rolff wrote: > Instead of doing round robin load balancing why not do a URI ba

Re: NGINX stale-while-revalidate cluster

2017-07-07 Thread Joan Tomàs i Buliart
Hi Lucas On 07/07/17 12:12, Lucas Rolff wrote: Instead of doing round robin load balancing why not do a URI based load balancing? Then you ensure your cached file is only present on a single machine behind the load balancer. Yes, we considered this option but it forces us to deploy and mainta

Re: NGINX stale-while-revalidate cluster

2017-07-07 Thread Lucas Rolff
quire some work, but at least over time your "overhead" should be less. From: nginx on behalf of Joan Tomàs i Buliart Reply-To: Date: Friday, 7 July 2017 at 11.52 To: Subject: NGINX stale-while-revalidate cluster Hi, We are implementing an stale-while-revalidat

NGINX stale-while-revalidate cluster

2017-07-07 Thread Joan Tomàs i Buliart
Hi, We are implementing an stale-while-revalidate webserver cluster with NGINX. We are using the new proxy_cache_background_update to answer request as soon as possible while NGINX updates the content from the origin in the background. This solution works perfectly when the requests for the sa