[PR #8049] Implement OLLAMA_MAX_KEEP_ALIVE environment variable #43850

Open
opened 2026-04-24 23:25:31 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/8049
Author: @jhbruhn
Created: 12/11/2024
Status: 🔄 Open

Base: mainHead: maxkeepalive


📝 Commits (1)

  • 09e2a95 feat: Implement OLLAMA_MAX_KEEP_ALIVE environment variable to cap the keep_alive of models to a maximum value

📊 Changes

5 files changed (+72 additions, -1 deletions)

View changed files

📝 cmd/cmd.go (+1 -0)
📝 docs/faq.md (+3 -0)
📝 envconfig/config.go (+23 -0)
📝 envconfig/config_test.go (+33 -0)
📝 server/sched.go (+12 -1)

📄 Description

In cooperative server environments, it is desirable to cap the keep_alive value of models to a maximum duration. This enables server administrators to guarantee that models are unloaded at some point if they are not needed anymore.

For this, I propose to introduce the OLLAMA_MAX_KEEP_ALIVE environment variable, which allows the administrator to specify a maximum keep alive value at which all other requests will be capped. This additionally disallows indefinite loading of models.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/8049 **Author:** [@jhbruhn](https://github.com/jhbruhn) **Created:** 12/11/2024 **Status:** 🔄 Open **Base:** `main` ← **Head:** `maxkeepalive` --- ### 📝 Commits (1) - [`09e2a95`](https://github.com/ollama/ollama/commit/09e2a9526cbb5fd70bed8c331d0028f44b691c82) feat: Implement OLLAMA_MAX_KEEP_ALIVE environment variable to cap the keep_alive of models to a maximum value ### 📊 Changes **5 files changed** (+72 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd.go` (+1 -0) 📝 `docs/faq.md` (+3 -0) 📝 `envconfig/config.go` (+23 -0) 📝 `envconfig/config_test.go` (+33 -0) 📝 `server/sched.go` (+12 -1) </details> ### 📄 Description In cooperative server environments, it is desirable to cap the keep_alive value of models to a maximum duration. This enables server administrators to guarantee that models are unloaded at _some_ point if they are not needed anymore. For this, I propose to introduce the `OLLAMA_MAX_KEEP_ALIVE` environment variable, which allows the administrator to specify a maximum keep alive value at which all other requests will be capped. This additionally disallows indefinite loading of models. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-24 23:25:31 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#43850