[PR #17837] [MERGED] feat: Impelement Milvus multitenancy // breaking: set milvus multitenancy as standard option (just like Qdrant already is) #24569

Closed
opened 2026-04-20 05:28:04 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/17837
Author: @Classic298
Created: 9/28/2025
Status: Merged
Merged: 9/29/2025
Merged by: @tjbck

Base: devHead: milvus-multitenancy


📝 Commits (7)

📊 Changes

4 files changed (+314 additions, -5 deletions)

View changed files

📝 backend/open_webui/config.py (+5 -2)
backend/open_webui/retrieval/vector/dbs/milvus_multitenancy.py (+288 -0)
📝 backend/open_webui/retrieval/vector/dbs/qdrant_multitenancy.py (+7 -0)
📝 backend/open_webui/retrieval/vector/factory.py (+14 -3)

📄 Description

Pull Request Checklist

Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.

Before submitting, make sure you've checked the following:

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests to validate the changes?
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • feat: Introduces a new feature or enhancement to the codebase

Changelog Entry

Description

This PR introduces a scalable, multi-tenant architecture for Milvus, mirroring the existing Qdrant implementation. When enabled via the ENABLE_MILVUS_MULTITENANCY_MODE environment variable, this mode utilizes a fixed set of shared collections instead of creating a new collection for each resource.

Data isolation is achieved by adding a resource_id to each vector's metadata and applying a filter expression (expr) to all database operations. This prevents the proliferation of collections, which can lead to performance degradation and resource exhaustion in large-scale deployments.

The implementation includes:

A new milvus_multitenancy.py module with the multi-tenant client.
Configuration variables in config.py to enable the mode and define the collection prefix.
Updated logic in the factory.py to conditionally select the appropriate Milvus client.

Breaking Changes

  • BREAKING CHANGE: Existing instances of milvus should set the new ENABLE_MILVUS_MULTITENANCY_MODE variable to false, or, if they don't, they need to reindex their database to migrate to the new collection schema. Long term, it is better to have the default for ENABLE_MILVUS_MULTITENANCY_MODE to be true because the same is the case for Qdrant and users will otherwise quickly run into collection limits of milvus.

Tested locally, works - tested with Milvus Lite.


Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.


🔄 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/open-webui/open-webui/pull/17837 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 9/28/2025 **Status:** ✅ Merged **Merged:** 9/29/2025 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `milvus-multitenancy` --- ### 📝 Commits (7) - [`50a2204`](https://github.com/open-webui/open-webui/commit/50a22040465e9032fe29543ba58c5cfcc64a3fe1) add env vars - [`8dc43f9`](https://github.com/open-webui/open-webui/commit/8dc43f9e3ab63d68d94c7a26d63dc8a4e113ab9d) Create milvus_multitenancy.py - [`01d4a8a`](https://github.com/open-webui/open-webui/commit/01d4a8ab7ae6500227619d10165e42a79f9f47e6) Update factory.py - [`27af450`](https://github.com/open-webui/open-webui/commit/27af4506dff0c37200c020459cad3f626fe6322e) Update config.py - [`1773a4d`](https://github.com/open-webui/open-webui/commit/1773a4d4b8295bd521959ad3ea6d881f68efbe0f) typo - [`0e99c43`](https://github.com/open-webui/open-webui/commit/0e99c434956b59f9763166770a5da4e11ee530b1) ADD FAT WARNING - [`b1e6363`](https://github.com/open-webui/open-webui/commit/b1e63639cd6a4f1830e4f5873be7f06ba99c9e71) ADD FAT WARNING - QDRANT ### 📊 Changes **4 files changed** (+314 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/config.py` (+5 -2) ➕ `backend/open_webui/retrieval/vector/dbs/milvus_multitenancy.py` (+288 -0) 📝 `backend/open_webui/retrieval/vector/dbs/qdrant_multitenancy.py` (+7 -0) 📝 `backend/open_webui/retrieval/vector/factory.py` (+14 -3) </details> ### 📄 Description # Pull Request Checklist ### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request. **Before submitting, make sure you've checked the following:** - [X] **Target branch:** Please verify that the pull request targets the `dev` branch. - [X] **Description:** Provide a concise description of the changes made in this pull request. - [X] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [X] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources? - [X] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [X] **Testing:** Have you written and run sufficient tests to validate the changes? - [X] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [X] **Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following: - **BREAKING CHANGE**: Significant changes that may affect compatibility - **feat**: Introduces a new feature or enhancement to the codebase # Changelog Entry ### Description This PR introduces a scalable, multi-tenant architecture for Milvus, mirroring the existing Qdrant implementation. When enabled via the ENABLE_MILVUS_MULTITENANCY_MODE environment variable, this mode utilizes a fixed set of shared collections instead of creating a new collection for each resource. Data isolation is achieved by adding a resource_id to each vector's metadata and applying a filter expression (expr) to all database operations. This prevents the proliferation of collections, which can lead to performance degradation and resource exhaustion in large-scale deployments. The implementation includes: A new milvus_multitenancy.py module with the multi-tenant client. Configuration variables in config.py to enable the mode and define the collection prefix. Updated logic in the factory.py to conditionally select the appropriate Milvus client. ### Breaking Changes - **BREAKING CHANGE**: Existing instances of milvus should set the new ENABLE_MILVUS_MULTITENANCY_MODE variable to false, or, if they don't, they need to reindex their database to migrate to the new collection schema. Long term, it is better to have the default for ENABLE_MILVUS_MULTITENANCY_MODE to be `true` because the same is the case for Qdrant and users will otherwise quickly run into collection limits of milvus. Tested locally, works - tested with Milvus Lite. --- ### Contributor License Agreement By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <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-20 05:28:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#24569