Skip to content

server : add --sleep-mode <keep-alive/terminate> to optionally exit process on idle - #25243

Closed
DEV-DUFORD wants to merge 5 commits into
ggml-org:masterfrom
DEV-DUFORD:zd/server-sleep-mode
Closed

server : add --sleep-mode <keep-alive/terminate> to optionally exit process on idle#25243
DEV-DUFORD wants to merge 5 commits into
ggml-org:masterfrom
DEV-DUFORD:zd/server-sleep-mode

Conversation

@DEV-DUFORD

Copy link
Copy Markdown
Contributor

Overview

Adds a llama-server argument for determining what to do to a child process when they hit the sleep state. I've noticed on two of my rigs (gfx900 and gfx906) that when the child process goes into a sleep state, the idle power draw and clocks stay relatively high due to the child process still claiming resources on the GPUs. This results, at least for me, with a decent amount of wasted electricity and higher idle thermals that is super wasteful (my gfx900 cards are idling 10C higher in the normal sleep mode vs truly idle)

Argument added is --sleep-mode, options are

  • keep-alive - Logic as it stands today, child frees resources but is still alive
  • terminate - New option, on entering sleep the child process is terminated

Depending on the system there's probably not too much penalty on just using keep-alive, I can imagine consumer GPUs idle just fine, but on these old data center cards the trade-off of letting llama-server spawn a new child 100% beats the large power draw and thermal drift.

Requirements

  • I have read and agree with the contributing guidelines: Yep
  • AI usage disclosure: Yes, I used Opus 4.8 w/ the Copilot CLI harness to do some initial investigation, as I noticed on my rigs that I was having unreasonably high idle temps when using sleep-idle-seconds, up in the 55C range, when I was expecting more in the 37C area, where they typically idle. That started my investigation, which led to me better understanding how the sleep logic works for children processes. Springboarding off of this, I made the llama-server arg by hand, then used copilot to check it, and add a little bit of documentation. Then, went through by hand and refined said documentation.

Frees all resources (including GPU device context) by exiting the
process on idle; a supervisor (router or systemd) respawns on demand.

Assisted-by: GitHub Copilot CLI
@DEV-DUFORD
DEV-DUFORD requested review from a team as code owners July 2, 2026 16:19
@github-actions github-actions Bot added documentation Improvements or additions to documentation server labels Jul 2, 2026
@ngxson

ngxson commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

it's not the clean solution, but rather a hacky one that doesn't address the root cause

please try #25265 , if it's still not working correctly, that's the problem of llama_backend_free()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants