Purge files from proxy_cache

Hi, i’ve set a proxy cache for my app ( app is allso served by nginx ).
My problem is that i would like to have my app control the cache a
little bit so i have hooks that delete files whith keys matching certain
paths when some events in the app take place. This also works ok but the
problem is that during stress testing if i remove a file from the nginx
cache i get a lot of php-fpm processes stampeeding to generate that file
in the cache.

I would like to mention that i am using proxy_cache_use_stale updating
in order to prevent stampeeding when nginx needs to rebuild cached pages
that have expired naturally but that won’t help when i remove them from
the cache myself.

Question is … how can i make certain pages expire when the application
decides they need to be refreshed ? or … how can i safely delete them
and not have a php riot ?

Posted at Nginx Forum:

that have expired naturally but that won’t help when i remove them from
the cache myself.

Question is … how can i make certain pages expire when the application
decides they need to be refreshed ? or … how can i safely delete them
and not have a php riot ?

Either use this: GitHub - FRiCKLE/ngx_cache_purge: nginx module which adds ability to purge content from FastCGI, proxy, SCGI and uWSGI caches.

Or just delete the file. This could be handy in that case:

–appa

Antonio P.P. Almeida Wrote:

cache i get a lot of php-fpm processes

that case:

GitHub - perusio/nginx-cache-purge: A bash script for deleting items from Nginx cache

–appa


nginx mailing list
[email protected]
nginx Info Page

Well … i kind of figured out how to actually delete the files from the
cache by greping for certain key patterns so i am able to actually
remove them. The problem is that right after i remove them nginx will
try to rebuild them and at 1000 req/s a lot of php-php processes will
come up to try and generate the missing cache page which will cause a
drop in the reqs’s ( i think requests start getting http error pages
actually ). So that is my problem … the fact that i have no control
over how uncached pages are created. I would like just 1 process to
generate the missing page and the others to wait for it to be available
or something. I guess i’m looging for the functionality that

proxy_cache_use_stale updating

adds but for missing files. That will only keep me safe from updating of
cached and expired pages.

Posted at Nginx Forum:

proxy_cache_use_stale updating

adds but for missing files. That will only keep me safe from updating of
cached and expired pages.

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_lock

http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_cache_lock

–appa