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()
failed (28: No space left on device) while reading upstream, client:
server: , request: “GET /xxx.jpg HTTP/1.1”, upstream: "
http://127.0.0.1:81/xxx.jpg", host: “xxx.com”, referrer:
I see two problems here.
- Why didn’t max_size work and clear the space in the tmpfs mount when
got past 1500m?
- Why doesn’t nginx just bypass the cache and serve from upstrean when
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?