Remove auto-scaling of workers based on CPU count in gunicorn config
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
# gunicorn_config.py
|
# gunicorn_config.py
|
||||||
import os
|
import os
|
||||||
import multiprocessing
|
|
||||||
from lightrag.kg.shared_storage import finalize_share_data
|
from lightrag.kg.shared_storage import finalize_share_data
|
||||||
from lightrag.api.utils_api import parse_args
|
from lightrag.api.utils_api import parse_args
|
||||||
|
|
||||||
@@ -10,10 +9,6 @@ args = parse_args()
|
|||||||
# Determine worker count - from environment variable or command line arguments
|
# Determine worker count - from environment variable or command line arguments
|
||||||
workers = int(os.getenv("WORKERS", args.workers))
|
workers = int(os.getenv("WORKERS", args.workers))
|
||||||
|
|
||||||
# If not specified, use CPU count * 2 + 1 (Gunicorn recommended configuration)
|
|
||||||
if workers <= 1:
|
|
||||||
workers = multiprocessing.cpu_count() * 2 + 1
|
|
||||||
|
|
||||||
# Binding address
|
# Binding address
|
||||||
bind = f"{os.getenv('HOST', args.host)}:{os.getenv('PORT', args.port)}"
|
bind = f"{os.getenv('HOST', args.host)}:{os.getenv('PORT', args.port)}"
|
||||||
|
|
||||||
@@ -44,7 +39,7 @@ def on_starting(server):
|
|||||||
You can use this function to do more initialization tasks for all processes
|
You can use this function to do more initialization tasks for all processes
|
||||||
"""
|
"""
|
||||||
print("=" * 80)
|
print("=" * 80)
|
||||||
print(f"GUNICORN MASTER PROCESS: on_starting jobs for all {workers} workers")
|
print(f"GUNICORN MASTER PROCESS: on_starting jobs for {workers} worker(s)")
|
||||||
print(f"Process ID: {os.getpid()}")
|
print(f"Process ID: {os.getpid()}")
|
||||||
print("=" * 80)
|
print("=" * 80)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user