Nginx: Protecting upstream from overload on cache miss

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. 

<3 Nginx


Copyright © 2020 Jakub Holý
Powered by Cryogen
Theme by KingMob