Opens a larger view. Escape closes it.

home-server

README.md

perf-daemon

The one piece here that isn’t a package. This box streams games most nights, and an RX 9070 XT asked to encode a stream while something else wants the GPU doesn’t sort that out gracefully on its own. So a small Python daemon runs as a system service, listens to Docker’s container events, and decides what the machine should be optimising for.

perf-daemon.py holds a fixed map from container names to workload types — Sunshine is gaming, Ollama and Open WebUI are an LLM, Jellyfin and Tdarr are video — and a priority order: gaming over LLM over video over the balanced default. On every start or stop of a mapped container it recomputes the best profile and, only if that changed, calls perf-mode. perf-mode.sh sets the CPU’s energy-performance preference through set-cpu-epp.sh (performance for gaming, balance_performance for LLM and video work, power for powersave) and the GPU’s power profile and cap through gpu-profile.sh (3D full-screen at the hardware maximum for gaming, compute for LLM, video for transcoding, the boot default otherwise). The unit starts it after Docker and restarts it on failure.

  • perf-daemon.py — the daemon, installed as /usr/local/bin/perf-daemon
  • perf-mode.sh, set-cpu-epp.sh, gpu-profile.sh — the scripts it calls, installed without the extension
  • perf-daemon.service — the system unit