mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #15195] [MERGED] [PERF] Proper default pooling settings #10548
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/15195
Author: @prene
Created: 6/21/2025
Status: ✅ Merged
Merged: 6/21/2025
Merged by: @tjbck
Base:
dev← Head:proper-default-pooling-settings📝 Commits (1)
63d99abChange default db pooling📊 Changes
2 files changed (+8 additions, -6 deletions)
View changed files
📝
backend/open_webui/env.py(+3 -5)📝
backend/open_webui/internal/db.py(+5 -1)📄 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:
devbranch.https://github.com/open-webui/docs/pull/592
Changelog Entry
Changed default pooling to let SQLAlchemy figure out optimal pooling strategy in case DATABASE_POOL_SIZE is not set.
Description
See discussion in https://github.com/open-webui/open-webui/pull/15175
This PR defaults the database pooling setting to "automatic" instead of NullPool for a better out-of-the-box experience, minimizing user frustration with slow API responses when using any db that is not SQLite.
Why?
It seems that some users, especially those using non-local databases, see slow response times from the API. One reason is that DATABASE_POOL_SIZE must be manually set to something that is appropriate for the anticipated workload. However, defaulting DATABASE_POOL_SIZE to 0 currently disables pooling (NullPool) and introduces an unnecessary bottleneck.
This change will:
I argue that this change provides a much better out-of-the-box experience. While users are still encouraged to configure the database pool size based on their specific needs and expected workload to handle concurrent requests efficiently, defaulting to "auto" removes a harmful and unnecessary performance bottleneck for all users, particularly those connecting to remote databases, where a default of NullPool is nonsense.
Changed
Additional Information
See discussion in https://github.com/open-webui/open-webui/pull/15175
https://docs-sqlalchemy.readthedocs.io/ko/latest/core/pooling.html
Screenshots or Videos
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.