Why is my server response time over 400 ms for a fully cached site?

2018-10-25 Thread Quintin Par
Cross-posted at Stackoverflow I have a website with all of the pages served from nginx’s http cache and rarely invalidated or expired. The average total page download size is around 2 MB B

Will Nginx serve stale cache after expiry if was unable to refresh the cache?

2018-10-01 Thread Quintin Par
Relevant code: proxy_cache_valid 200 301 302 1d; proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504; proxy_cache_background_update on; proxy_cache_lock on; The URL in question is obviously cached for 1 day. 15 minutes after the day is over, t

Re: Avoiding Nginx restart when rsyncing cache across machines

2018-09-13 Thread Quintin Par
Hi Lucas, Thank you for this. GEM all over. I didn’t know curl had –resolve. This is a more a generic question: How does one ensure cache consistency on all edges? Do people resort to a combination of expiry + background update + stale responding? What if one edge and the origin was updated t

Re: Avoiding Nginx restart when rsyncing cache across machines

2018-09-12 Thread Quintin Par
when hit with enormous spikes of requests. > > This is nuanced, subtle stuff though. > > Is your site something that you can disclose publicly? > > > Peter > > > > On 12 Sep 2018, at 7:23 PM, Quintin Par wrote: > > Hi Lucas, > > > The cache is pretty b

Re: Avoiding Nginx restart when rsyncing cache across machines

2018-09-12 Thread Quintin Par
Hi Lucas, 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. Admittedly I have a not so complex cache architecture. i.e. all cache machines

Re: Avoiding Nginx restart when rsyncing cache across machines

2018-09-12 Thread Quintin Par
once again. - Quintin On Wed, Sep 12, 2018 at 7:46 AM Maxim Dounin wrote: > Hello! > > On Tue, Sep 11, 2018 at 04:45:42PM -0700, Quintin Par wrote: > > > I run a mini CDN for a static site by having Nginx cache machines (in > > different locations) in front of the ori

Avoiding Nginx restart when rsyncing cache across machines

2018-09-11 Thread Quintin Par
I run a mini CDN for a static site by having Nginx cache machines (in different locations) in front of the origin and load balanced by Cloudflare. Periodically I run rsync pull to update the cache on each of these machines. Works well, except that I realized I need to restart Nginx and reload is

Re: Nginx: allow access to admin ONLY if the request has a secret header. Do this without the if-evil case.

2018-05-28 Thread Quintin Par
Thank you for validating. I was not sure if the “if” here was a good use. - Quintin On Mon, May 28, 2018 at 9:28 AM, Aleksandar Lazic wrote: > On 28/05/2018 07:16, Quintin Par wrote: > >> My website’s being hit hard and I am trying to see if I can limit this at >> the lo

Nginx: allow access to admin ONLY if the request has a secret header. Do this without the if-evil case.

2018-05-28 Thread Quintin Par
My website’s being hit hard and I am trying to see if I can limit this at the load balancer (Nginx) level by cutting off requests that don’t have a special header. I’ve seen some solutions that involve the if statement, notably https://stackoverflow.com/questions/18970620/nginx-reject-request-if-

Re: Debugging Nginx Cache Misses: Hitting high number of MISS despite high proxy valid

2018-05-15 Thread Quintin Par
proxy_cache_key "$uri|$e4x_currency|$num_items"; > proxy_cache product_arrays; > # Add Canonical URL string > set $folder_id $arg_FOLDER%3C%3Efolder_id; > set $canonical_url "http://$http_host$uri";; >

Re: Debugging Nginx Cache Misses: Hitting high number of MISS despite high proxy valid

2018-05-13 Thread Quintin Par
e.edu&userId=74734&signature=0767ce63378dc575> > > > > > <https://mailtrack.io/trace/link/8357a0bdd8c40c2ff5b7d91c7797cbc7a8535 > <https://mailtrack.io/trace/link/661443b9951f60c19cd0ed2ec67ca9c38485a127?url=https%3A%2F%2Fmailtrack.io%2Ftrace%2Flink%2F8357a0bdd8c40c

Re: Debugging Nginx Cache Misses: Hitting high number of MISS despite high proxy valid

2018-05-12 Thread Quintin Par
ee that gets a lot of MISS’s – if there’s > odd headers such as cookies etc, then you’ll most likely experience a bad > cache if your nginx is configured to not ignore those headers. > > > > *From: *nginx on behalf of Quintin Par < > quintin...@gmail.com> > *Reply-To:

Debugging Nginx Cache Misses: Hitting high number of MISS despite high proxy valid

2018-05-12 Thread Quintin Par
My proxy cache path is set to a very high size proxy_cache_path /var/lib/nginx/cache levels=1:2 keys_zone=staticfilecache:180m max_size=700m; and the size used is only sudo du -sh * 14M cache 4.0Kproxy Proxy cache valid is set to proxy_cache_valid 200 120d; I track HIT and MISS via add_