proxy_cache_path max_size doesn't work

Elias Abacioglu elias.abacioglu at deltaprojects.com
Tue Mar 8 12:22:42 UTC 2016


Hi,

I'm using nginx as a reverse proxy with caching on a ramdisk
/var/cache/nginx is a tmpfs of the size 1800m.
And this is my proxy_cache_path line in nginx:

proxy_cache_path /var/cache/nginx levels=1:2 use_temp_path=off
keys_zone=default:50m inactive=120m max_size=1500m;

This is the error message when the ramdisk is filled.

[crit] 1460#0: *14844194 pwritev() "/var/cache/nginx/temp/3/12/0001578123"
failed (28: No space left on device) while reading upstream, client: XXX,
server: , request: "GET /xxx.jpg HTTP/1.1", upstream: "
http://127.0.0.1:81/xxx.jpg", host: "xxx.com", referrer: "http://xxx.com/"


I see two problems here.
1. Why didn't max_size work and clear the space in the tmpfs mount when it
got past 1500m?
2. Why doesn't nginx just bypass the cache and serve from upstrean when the
mount is full instead of hard failing?

And what solutions do I have?
Do I increase the ramdisk/tmpfs size?
Do I decrease the max_size?
Should I run a external cronjob that restarts nginx when the ramdisk is
more than 1500MB?

Or is nginx proxy_cache_path broken and do I need to change to another
solution like squid or varnish?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160308/7c72e9d1/attachment.html>


More information about the nginx mailing list