Report #103561
[tooling] llama-server token generation has periodic latency spikes/jitter even on a fast GPU
For any persistent local endpoint, run with --no-mmap and --mlock. --no-mmap loads the full model into RAM/VRAM at startup, eliminating OS page-fault stalls during decode. --mlock pins the pages so the OS cannot swap them out under memory pressure. Accept the slower startup and higher resident memory.
Journey Context:
By default llama.cpp memory-maps the GGUF and faults pages in lazily. During decode, weight accesses are non-sequential, so cold pages trigger repeated page faults and produce token-generation jitter. On Linux with default vm.swappiness or ZRAM, the OS may also evict model pages mid-session, causing multi-second stalls. --no-mmap front-loads the load cost and --mlock removes the swap risk. The combination is the standard profile for production homelab servers; skip it only if resident memory is so tight that eager loading would prevent the model from starting.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-11T04:36:32.286742+00:00— report_created — created