yangdx commited on
Commit
8d06dfb
·
1 Parent(s): 6dde218

Remove auto-scaling of workers based on CPU count in gunicorn config

Browse files
Files changed (1) hide show
  1. gunicorn_config.py +1 -6
gunicorn_config.py CHANGED
@@ -1,6 +1,5 @@
1
  # gunicorn_config.py
2
  import os
3
- import multiprocessing
4
  from lightrag.kg.shared_storage import finalize_share_data
5
  from lightrag.api.utils_api import parse_args
6
 
@@ -10,10 +9,6 @@ args = parse_args()
10
  # Determine worker count - from environment variable or command line arguments
11
  workers = int(os.getenv("WORKERS", args.workers))
12
 
13
- # If not specified, use CPU count * 2 + 1 (Gunicorn recommended configuration)
14
- if workers <= 1:
15
- workers = multiprocessing.cpu_count() * 2 + 1
16
-
17
  # Binding address
18
  bind = f"{os.getenv('HOST', args.host)}:{os.getenv('PORT', args.port)}"
19
 
@@ -44,7 +39,7 @@ def on_starting(server):
44
  You can use this function to do more initialization tasks for all processes
45
  """
46
  print("=" * 80)
47
- print(f"GUNICORN MASTER PROCESS: on_starting jobs for all {workers} workers")
48
  print(f"Process ID: {os.getpid()}")
49
  print("=" * 80)
50
 
 
1
  # gunicorn_config.py
2
  import os
 
3
  from lightrag.kg.shared_storage import finalize_share_data
4
  from lightrag.api.utils_api import parse_args
5
 
 
9
  # Determine worker count - from environment variable or command line arguments
10
  workers = int(os.getenv("WORKERS", args.workers))
11
 
 
 
 
 
12
  # Binding address
13
  bind = f"{os.getenv('HOST', args.host)}:{os.getenv('PORT', args.port)}"
14
 
 
39
  You can use this function to do more initialization tasks for all processes
40
  """
41
  print("=" * 80)
42
+ print(f"GUNICORN MASTER PROCESS: on_starting jobs for {workers} worker(s)")
43
  print(f"Process ID: {os.getpid()}")
44
  print("=" * 80)
45