Production-ready configs and scripts to run lancachenet/monolithic on a 25 GbE host (512 GB RAM, 44 cores). Focus areas: CPU balance, NIC offloads/RSS, THP compaction control, low-IO logging, safe DNS, and a clean Docker setup.
Use at your own risk; tune values for your environment. Tested on Ubuntu/Debian-class hosts.
docker-compose.yml– Host-network monolithic, bridge DNS (MTU 9200), persistent configs/logssysctl/sysctl.conf– Kernel networking & writeback tuningsystemd/disable-thp.service– Sets THP tomadviseand disables proactive compactionsystemd/tune-25g.service– Applies NIC offload/RSS/IRQ/RPS/MTU settings at bootscripts/tune-25g.sh– The tuning script used by the servicescripts/verify.sh– One-shot health checks (CPU spread, NIC stats, sysctl)configs/nginx/...– Minimal Nginx overrides: disable access logs, cache log FDsconfigs/bind/named.conf.options– Quiet logging & safe ACLs
Assumptions
- NIC:
enp4s0f0np0(change inscripts/tune-25g.shif different)- Jumbo frames supported end-to-end (switch ports allow ≥ 9200 MTU)
- Host paths:
/lancache-root/lancache– config root (bind+nginx)/data/lancache/cache– cache data/var/log/lancache/logs– app logs
# Adjust the target root as needed
sudo rsync -av --delete configs/ /lancache-root/lancache/
sudo rsync -av --delete systemd/ /etc/systemd/system/
sudo rsync -av --delete sysctl/ /etc/
sudo rsync -av --delete scripts/ /usr/local/sbin/
sudo chmod +x /usr/local/sbin/*.shsudo systemctl daemon-reload
sudo systemctl enable --now disable-thp.service
sudo systemctl enable --now tune-25g.service
sudo sysctl --systemsudo mkdir -p /data/lancache/cache /var/log/lancache/logs
sudo mkdir -p /lancache-root/lancache/{bind,nginx}
sudo chown -R root:root /lancache-root/lancacheCreate .env beside docker-compose.yml (see .env.example).
USE_GENERIC_CACHE=true
LANCACHE_IP=172.16.172.10
DNS_BIND_IP=172.16.172.10
UPSTREAM_DNS=8.8.8.8; 9.9.9.9; 1.1.1.1
CACHE_ROOT=/data/lancache
DATA_ROOT=/lancache-root/lancache
CACHE_DISK_SIZE=19000g
MIN_FREE_DISK=100g
CACHE_INDEX_SIZE=4750m
CACHE_MEM_SIZE=16000m
CACHE_SLICE_SIZE=4m
TZ=Asia/Dhakadocker compose pull
docker compose up -dsudo /usr/local/sbin/verify.sh
# DNS test
dig @${DNS_BIND_IP} google.com +short- DNS
connection refused– In container, BIND mustlisten-on any;(already set) and yourports:mapping should target${DNS_BIND_IP}:53. Reload withrndc reconfigor restart the container. - One hot CPU/core (85%+) – Ensure
disable-thp.serviceis running (preventskcompactd0spikes) andtune-25g.serviceapplied (IRQ/RSS spread). Re-run/usr/local/sbin/tune-25g.shafter NIC name changes. - Drops on NIC – Run
ethtool -S <iface>and checkrx_missed|rx_no_buffer|rx_errors. Increase queues (ethtool -L) or coalescing (ethtool -C rx-usecs 75 tx-usecs 75) carefully. - Jumbo frames – MTU 9200 is set on host. Ensure switch ports support jumbo (>9000). Mismatch → fragmentation/drops.
- High disk I/O – Keep Nginx
access_log off;and BIND logging minimal. Cache index size should match disk size (~250m per 1 TB).
- DNS is not an open resolver: ACLs restrict query/recursion to private ranges.
- Use host firewalls as appropriate; this repo doesn’t install iptables rules.
MIT