mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-08 04:16:03 -05:00
[PR #13679] [CLOSED] perf: implement multi-tenancy for Qdrant vector store client #62119
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/13679
Author: @loitragg
Created: 5/8/2025
Status: ❌ Closed
Base:
dev← Head:apply-multitenant-for-qdrant📝 Commits (3)
8c6fb34perf: implement multi-tenancy support in QdrantClient with tenant ID handling and collection managementfbd0b18perf: check collection exists will be turn to try-catch to make 1 less request to Qdrant06805e2fix: enhance error handling for collection creation in QdrantClient to manage "already exists" conflicts📊 Changes
1 file changed (+605 additions, -108 deletions)
View changed files
📝
backend/open_webui/retrieval/vector/dbs/qdrant.py(+605 -108)📄 Description
Pull Request Checklist
Before submitting, make sure you've checked the following:
devbranch.refactor)Changelog Entry
Discussions
Description
Background: In the discussion above, we were using a separate Qdrant collection for each entity (memory, knowledge base, file), which led to thousands of collections. This approach is an anti-pattern according to Qdrant documentation and causes excessive RAM usage.
Solution: Qdrant recommends using multi-tenancy with payload-based partitioning for efficient resource usage when dealing with a large number of logical collections (https://qdrant.tech/documentation/guides/multiple-partitions/). This change migrates the Qdrant database to utilize its multi-tenancy feature. Collections are now consolidated by entity type (Memories, Files, Knowledge, Web Search, YouTube), and data within these collections is partitioned using a
tenant_idfield in payloads.Changed
QdrantClientclass to use Qdrant's multi-tenancy feature while maintaining the same interface to avoid breaking changes in the application.Memories Collection,Files Collection,Knowledge Collection,Web Search Collection, andHash Based Collection(for Youtube and Web URL).tenant_idfield for data isolation within the new collections.payload_m=16(per-tenant indexing),m=0(disabled global index), and a keyword payload index fortenant_idwithis_tenant=true.Additional Information
Migration
The existing API interface of the
QdrantClientclass is maintained to avoid breaking changes in the application, ensuring a seamless transition. However, Open WebUI will unable to access all the old Qdrant collections. Go to: Admin Settings > Documents > Reindex Knowledge Base Vectors to migrating knowledgeRollback
Before running the migration in production:
If you need to roll back, restore from your backup.
Benefits of Multi-Tenancy
Before
After
Sequence Diagram(s)
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.