Strange behavior on proxy cache at high load spike

J.R. themadbeaker at
Tue May 5 00:54:43 UTC 2020

> After 2minutes response 'stabilizes' with correct size (in this example
> 1526025). Problem is also amplified due clients validate response and retry
> progressively if corrupted.

What is the response your upstream is sending back? If the 'corrupted'
data is still a 200, then nginx will cache that... You need to make
sure it's sending back a 5xx if it's overloaded or whatever error
would be relevant.

You might want to consider expanding your 'use_stale' like:

'proxy_cache_use_stale error timeout invalid_header http_500 http_502
http_503 http_504;'

Why are you wasting duplicating the data in the same SHM? Just set
'use_temp_path=off' in the proxy_cache_path and be done with it.

What is the valid cache time for the content? (i.e. the headers)  If
they are missing or things are set to 'no cache', then you are
obviously going to have issues...

More information about the nginx mailing list