The Holy Java

Building the right thing, building it right, fast

Nginx: Protecting upstream from overload on cache miss

Posted by Jakub Holý on October 1, 2015

These 2 magical lines will protect your upstream server from possible overload of many users try to access the same in cached or expired content: 

proxy_cache_use_stale updating timeout; # Serve the cached version even when outdated while refreshing it
proxy_cache_lock on; # Only one req is allowed to load/refresh the item, others wait / get the stale one 

You can verify this using Shopify’s Toxiproxy. 

❤ Nginx

Sorry, the comment form is closed at this time.

%d bloggers like this: