Welcome! Log In Create A New Profile

Advanced

Re: NGINX stale-while-revalidate cluster

All files from this thread

File Name File Size   Posted by Date  
olhgllimkponlhjm.gif 4.1 KB open | download Joan Tomàs i Buliart 07/07/2017 Read message
olhgllimkponlhjm.gif 4.1 KB open | download Lucas Rolff 07/07/2017 Read message
Lucas Rolff
July 07, 2017 06:14AM
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.

Sure there will be moments where this is not the case – let's assume that a box goes down, and traffic will switch, but in that case I'd as a "post task" take the moment from when the machine went down, until it came online again, find all requests that expired in the meantime, and flush it to ensure the entry is updated on the machine that had been down in the meantime.

It will still require some work, but at least over time your "overhead" should be less.

From: nginx <nginx-bounces@nginx.org> on behalf of Joan Tomàs i Buliart <joan.tomas@marfeel.com>
Reply-To: <nginx@nginx.org>
Date: Friday, 7 July 2017 at 11.52
To: <nginx@nginx.org>
Subject: NGINX stale-while-revalidate cluster




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 same object are served by the same NGINX server (when we have only one server or when we have a previous load balancer that classifies the requests).

In our scenario we have a round robin load balancer (ELB) and we need to scale the webservers layer. So, as a consequence, only the Nginx that receive the request updates the cache content while the others keep the old version.. This means that, we can send old versions of content due to the content not being updated on all the webservers. The problem accentuates when we put a CDN in front of the webservers.

We are thinking on developing something that once an Nginx instance updates its cache would let know all other instances to get a copy of the newest content. We are thinking about processing NGINX logs and, when it detects a MISS, EXPIRED or UPDATING cache status, it makes a HEAD request to the other NGINXs on the cluster to force the invalidation of this content.




Do any of you have dealt with this problem or a similar one?




We have also tried the post_action but it is blocking the client request until it completes. It is not clear for us which would be the best approach. The options that we are considering are:

- NGINX module
- LUA script
- External script that process syslog entries from NGINX

What would be your recommendation?


Many thanks in advance,



--
Joan Tomàs-Buliart


Joan Tomàs-Buliart
+34 931 785 950
www.marfeel.com
Discover our referral program!!


_______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Attachments:
open | download - olhgllimkponlhjm.gif (4.1 KB)
Subject Author Posted

NGINX stale-while-revalidate cluster Attachments

Joan Tomàs i Buliart July 07, 2017 05:54AM

Re: NGINX stale-while-revalidate cluster Attachments

Lucas Rolff July 07, 2017 06:14AM

Re: NGINX stale-while-revalidate cluster

Joan Tomàs i Buliart July 07, 2017 06:32AM

Re: NGINX stale-while-revalidate cluster

frank3427 July 07, 2017 09:26AM

Re: NGINX stale-while-revalidate cluster

pbooth July 07, 2017 09:40AM

Re: NGINX stale-while-revalidate cluster

oweng July 07, 2017 10:06AM

Re: NGINX stale-while-revalidate cluster

Joan Tomàs i Buliart July 08, 2017 09:02AM

Re: NGINX stale-while-revalidate cluster

pbooth July 08, 2017 09:32AM

Re: NGINX stale-while-revalidate cluster

Joan Tomàs i Buliart July 08, 2017 04:30PM

Re: NGINX stale-while-revalidate cluster

pbooth July 09, 2017 05:00PM

Re: NGINX stale-while-revalidate cluster

Maxim Dounin July 10, 2017 08:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 210
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready