[PR #13680] [MERGED] server: fix slow 'ollama rm' of models with many blobs #19606

Closed
opened 2026-04-16 07:11:36 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/13680
Author: @jmorganca
Created: 1/11/2026
Status: Merged
Merged: 1/12/2026
Merged by: @jmorganca

Base: mainHead: jmorganca/remove-many-blobs


📝 Commits (1)

  • 9588655 server: fix slow 'ollama rm' of models with many blobs

📊 Changes

1 file changed (+30 additions, -6 deletions)

View changed files

📝 server/manifest.go (+30 -6)

📄 Description

RemoveLayers was calling Manifests() for each layer to check if it was shared with other models. For models with many blobs (e.g., tensor models), this caused O(N*M) manifest reads. Now loads manifests once and builds a set of in-use digests. Our existing tests should cover this case well


🔄 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/13680 **Author:** [@jmorganca](https://github.com/jmorganca) **Created:** 1/11/2026 **Status:** ✅ Merged **Merged:** 1/12/2026 **Merged by:** [@jmorganca](https://github.com/jmorganca) **Base:** `main` ← **Head:** `jmorganca/remove-many-blobs` --- ### 📝 Commits (1) - [`9588655`](https://github.com/ollama/ollama/commit/95886558aa201ee151d7cc0270d4fc87e867bc6c) server: fix slow 'ollama rm' of models with many blobs ### 📊 Changes **1 file changed** (+30 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `server/manifest.go` (+30 -6) </details> ### 📄 Description RemoveLayers was calling Manifests() for each layer to check if it was shared with other models. For models with many blobs (e.g., tensor models), this caused O(N*M) manifest reads. Now loads manifests once and builds a set of in-use digests. Our existing tests should cover this case well --- <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-16 07:11:36 -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#19606