Hello!,
So I was testing around with my nginx steam cache and I noticed that in Luci under memory usage it was increasing.
Now this doesn't sound strange to me that it increases, but what I noticed when I stopped nginx it did not drop the usage, but when I start to delete the cache files it dropped rapidly.
To verify again I used seq command to write on the mount and indeed it increased again and it did also not decrease, once I stoppped the write operation only and I deleted the file it went down.
Im confused why this is, as im sure its not mounted to /overlay or /tmp but it is still mounted via fstab via block-mount as /mnt/sda2.
click to expand fstab
config global
option anon_swap '0'
option anon_mount '0'
option auto_swap '1'
option auto_mount '1'
option delay_root '5'
option check_fs '0'
config mount
option target '/mnt/mmcblk0p1'
option uuid '84173db5-fa99-e35a-95c6-28613cc79ea9'
option enabled '0'
config mount
option target '/'
option uuid 'ff313567-e9f1-5a5d-9895-3ba130b4a864'
option enabled '0'
config mount
option target '/mnt/sda1'
option uuid '4e2778c1-fb4c-4502-b6d7-54ab9572b7c0'
option enabled '0'
config mount
option target '/mnt/sda2'
option uuid 'f27b34f5-d44a-46f5-aac8-5720fa24cd1c'
option enabled '1'
config mount 'overlay'
option target '/overlay'
option uuid '4e2778c1-fb4c-4502-b6d7-54ab9572b7c0'
option enabled '1'
I did already played with the nginx configuration a little, changed worker connections, also the worker_processes but I think the problem is deeper than just nginx now since I experienced the same behaviour with the seq command.
nginx.conf (main)
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
user nginx;
worker_processes auto;
#error_log /var/log/nginx/error.log;
pid /opt/nginx.pid;
events {
worker_connections 100;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
log_format steam_cache '$remote_addr - $upstream_cache_status [$time_local] '
'"$host $request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
#access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
proxy_cache_path /mnt/sda2/cache/nginx/steamcache/depot/
levels=2:2
keys_zone=depot:10m
max_size=5g
inactive=365d;
proxy_cache_key "$scheme$uri";
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
# root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}
nginx-steam-cache.conf
server {
listen 80;
server_name *.steamcontent.com;
resolver 8.8.8.8;
access_log /mnt/sda2/cache/nginx/steamcontent.access.log;
error_log /mnt/sda2/cache/nginx/steamcontent.error.log;
location / {
proxy_next_upstream error timeout http_404;
proxy_pass http://$host$uri$is_args$args;
proxy_redirect off;
proxy_set_header Host $host;
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache depot;
proxy_cache_valid 200 301 302 10m;
proxy_cache_valid any 1y;
proxy_cache_use_stale error timeout invalid_header updating
http_500 http_502 http_503 http_504;
add_header Host $host;
add_header X-Mirror-Upstream-Status $upstream_status;
add_header X-Mirror-Upstream-Response-Time $upstream_response_time;
add_header X-Mirror-Status $upstream_cache_status;
add_header X-Forwarded-Host $host;
}
}
I'm using a Mochabin where the mount is on a 1tb WD SA500 m.2 drive running on OpenWrt 22.03.3 r20028-43d71ad93e.
I'm sure I misunderstood something with mounting and I would like some help
Thanks!