mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-17 08:21:12 -05:00
[PR #12617] [MERGED] feat: UVICORN_WORKERS variable and docs #77864
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/12617
Author: @Classic298
Created: 4/8/2025
Status: ✅ Merged
Merged: 4/8/2025
Merged by: @tjbck
Base:
dev← Head:dev📝 Commits (5)
f822d89Update env.py4c9a791Update env.py2c1d0e3Update start.sh65b5c6cUpdate start_windows.batf17befcUpdate init.py📊 Changes
4 files changed (+25 additions, -3 deletions)
View changed files
📝
backend/open_webui/__init__.py(+8 -1)📝
backend/open_webui/env.py(+14 -0)📝
backend/start.sh(+1 -1)📝
backend/start_windows.bat(+2 -1)📄 Description
Pull Request Checklist
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
This PR adds support for running OpenWebUI with multiple Uvicorn worker processes via a new environment variable UVICORN_WORKERS. This enhancement improves scalability and performance on multi-core systems by allowing the application to handle more concurrent requests.
Why it is needed
So, a proper solution is needed.
Documentation: https://github.com/open-webui/docs/pull/482
Solves
Solves this issue https://github.com/open-webui/open-webui/issues/12286
Solves this discussion https://github.com/open-webui/open-webui/discussions/12362
Solves this discussion https://github.com/open-webui/open-webui/discussions/9032
Relates to
Related to:
https://github.com/open-webui/open-webui/issues/10365#issuecomment-2784050405
Added
Added new environment variable UVICORN_WORKERS to control the number of Uvicorn worker processes
Added worker parameter to all server startup methods (start.sh, windows-start.bat, init.py)
Added validation and normalization of the worker count (ensuring it's at least 1 and defaults to 1)
Changed
Modified the serve() command in init.py to use the configured number of workers
Modified the dev() command to conditionally use multiple workers only when hot-reload is disabled
Updated bash and batch scripts to respect the UVICORN_WORKERS environment variable
Additional Information
The default value is 1 worker, if environment variable is not specified.
If a kubernetes/k8s/helm multi-node (multi pod) cluster is being used, it is advised to NOT change the UVICORN_WORKERS variable, i.e. leave it at it's default value, which is 1.
A pod should only run one uvicorn worker at a time.
Works with all startup methods: pip install startup (open-webui serve), bash script (start.sh), and Windows script (windows-start.bat)
Screenshots or Videos
N/A (Server-side enhancement with no visual changes)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.