feat(server): add configurable worker count to prevent single-worker blocking#470
Merged
MaojiaSheng merged 1 commit intovolcengine:mainfrom Mar 7, 2026
Merged
Conversation
…blocking
Add --workers CLI flag and server.workers config option to allow running
uvicorn with multiple worker processes. This prevents a single slow or
blocking request from stalling the entire HTTP server, including
lightweight endpoints like /health.
When workers > 1, the server uses uvicorn's factory mode with an import
string so each worker process can independently initialize the
application.
Configuration:
- CLI: openviking-server --workers 4
- ov.conf: { "server": { "workers": 4 } }
- Default: 1 (preserves existing behavior)
Closes #464
This was referenced Mar 6, 2026
MaojiaSheng
approved these changes
Mar 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
--workersCLI flag andserver.workersconfig option to allow running the OpenViking HTTP server with multiple uvicorn worker processes.Problem
As reported in #464, OpenViking runs with a single uvicorn worker by default. A single slow or blocking request (e.g. a heavy
commitoperation) can stall the entire server, causing even lightweight endpoints like/healthto become unresponsive. This is a serious availability issue for production deployments.Solution
workers: int = 1field toServerConfig--workersCLI argument toopenviking-serverserver.workersinov.confconfig fileworkers > 1, use uvicorn's factory mode with an import string so each worker process can independently initialize the application1to preserve existing single-worker behaviorConfiguration
Changes
openviking/server/config.py: Addworkersfield toServerConfigand load from configopenviking/server/bootstrap.py: Add--workersCLI arg, multi-worker uvicorn launch with factory modeNotes
factory=Truewith the app import string, which is the standard approach for multi-process uvicornrun_in_executor), that can be addressed in follow-up PRsCloses #464