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.
- Why didn’t max_size work and clear the space in the tmpfs mount when
it
got past 1500m? - 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?