[PR #12616] llm: Optimize memory calculation on ZFS, Add env var control for memory check and log level #12624

Open
opened 2025-11-12 16:41:12 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/12616
Author: @arunskurian
Created: 10/14/2025
Status: 🔄 Open

Base: mainHead: zfs-memcheck


📝 Commits (6)

  • 2164189 Projects/2025.4.0.archive (#12)
  • 47b7b47 DLPXECO-12676 Build error in security.go loadfunction
  • 046e33c Upgrading ollama version (#13)
  • b89f481 Merge branch 'ollama:main' into main
  • a10d926 Merge branch 'ollama:main' into main
  • 1324148 Consolidate memory check snippet. Remove CPU build files (#14)

📊 Changes

6 files changed (+117 additions, -9 deletions)

View changed files

📝 cmd/cmd.go (+1 -0)
📝 docs/faq.md (+20 -0)
📝 envconfig/config.go (+9 -0)
📝 llm/memory.go (+54 -0)
📝 llm/server.go (+25 -8)
📝 server/routes.go (+8 -1)

📄 Description

Context

This PR addresses the following 2 issues

1. Free Memory Calculation when running on ZFS + Env variable to bypass memory checks

(https://github.com/ollama/ollama/issues/5700)

For the Free Memory Calculation when running on ZFS, two changes have been introduced.

  1. By setting the OLLAMA_SKIP_MEMORY_CHECK environment variable to 1, this version can override Ollama's available system memory check. *Only for advanced use cases and must be used with caution
    If not set, memory checks will progress BAU.

  2. On ZFS machines, we now calculate the amount of memory that can be evicted from the Arc Cache, which allows us to proceed to loading the models. ZFS resizes the cache when we claim the memory thats captured by Arch Cache. However, there are guardrails on how much memory we can evict for use. This amount is calculated based on info read from zfs arcstats file.
    On non ZFS systems ( or when the zfs config cannot be read), the memory calculation will proceed as BAU.

2. Logging based on GIN_MODE

https://github.com/ollama/ollama/issues/8339


🔄 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/12616 **Author:** [@arunskurian](https://github.com/arunskurian) **Created:** 10/14/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `zfs-memcheck` --- ### 📝 Commits (6) - [`2164189`](https://github.com/ollama/ollama/commit/2164189200d5be638b4eeb2d9578ef7fa5645d46) Projects/2025.4.0.archive (#12) - [`47b7b47`](https://github.com/ollama/ollama/commit/47b7b473b32d7418ec4cc157db28a59d849475dd) DLPXECO-12676 Build error in security.go loadfunction - [`046e33c`](https://github.com/ollama/ollama/commit/046e33cea1b38f38fc05074721191f85da4e91c3) Upgrading ollama version (#13) - [`b89f481`](https://github.com/ollama/ollama/commit/b89f4815578fc865c6a45cb3e4287157beadfa47) Merge branch 'ollama:main' into main - [`a10d926`](https://github.com/ollama/ollama/commit/a10d926b5fd52d93f25c03f9553833a06e5b226a) Merge branch 'ollama:main' into main - [`1324148`](https://github.com/ollama/ollama/commit/13241488c21a6bd53905a84bcb6821ce9b006034) Consolidate memory check snippet. Remove CPU build files (#14) ### 📊 Changes **6 files changed** (+117 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd.go` (+1 -0) 📝 `docs/faq.md` (+20 -0) 📝 `envconfig/config.go` (+9 -0) 📝 `llm/memory.go` (+54 -0) 📝 `llm/server.go` (+25 -8) 📝 `server/routes.go` (+8 -1) </details> ### 📄 Description ## Context This PR addresses the following 2 issues ### 1. Free Memory Calculation when running on ZFS + Env variable to bypass memory checks (https://github.com/ollama/ollama/issues/5700) For the Free Memory Calculation when running on ZFS, two changes have been introduced. 1. By setting the OLLAMA_SKIP_MEMORY_CHECK environment variable to 1, this version can override Ollama's available system memory check. *Only for advanced use cases and must be used with caution If not set, memory checks will progress BAU. 2. On ZFS machines, we now calculate the amount of memory that can be evicted from the Arc Cache, which allows us to proceed to loading the models. ZFS resizes the cache when we claim the memory thats captured by Arch Cache. However, there are guardrails on how much memory we can evict for use. This amount is calculated based on info read from zfs arcstats file. On non ZFS systems ( or when the zfs config cannot be read), the memory calculation will proceed as BAU. ### 2. Logging based on GIN_MODE https://github.com/ollama/ollama/issues/8339 --- <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 2025-11-12 16:41:12 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama-ollama#12624