File size: 874 Bytes
74cf6bd
 
 
 
 
 
 
 
 
 
 
 
 
 
ad97a86
 
74cf6bd
 
 
0ad6b1b
74cf6bd
 
 
 
 
 
 
 
 
 
 
0ad6b1b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os
import multiprocessing

# Get the number of workers from environment variable or calculate based on CPU cores
workers_env = os.getenv("WORKERS")
if workers_env:
    workers = int(workers_env)
else:
    # Use the recommended formula: (2 * CPU cores) + 1
    workers = (2 * multiprocessing.cpu_count()) + 1

# Use Uvicorn worker class for ASGI support
worker_class = "uvicorn.workers.UvicornWorker"

# Bind to 0.0.0.0:7860
bind = "0.0.0.0:7860"

# Logging
accesslog = "-"  # Log to stdout
errorlog = "-"  # Log to stderr
loglevel = "info"

# Timeout configuration
timeout = 120  # 2 minutes
graceful_timeout = 30

# Worker settings
worker_connections = 1000  # Maximum number of connections each worker can handle
keepalive = 5  # Seconds to wait between client requests before closing connection

# For better performance with Uvicorn
proc_name = "vibe-coding-rag"