mirror of
https://github.com/khoj-ai/khoj
synced 2026-04-21 07:57:15 +00:00
Update gunicorn default timeouts, workers. Configure via env vars
Increase timeout to 180 (from 120s previous) and graceful timeout to 90 (from 30s default) to reduce Increase default gunicorn workers and make it configurable to better utilize (v)CPUs. This is manually configured (instead of using multiprocessing.cpu_count()) as VMs/containers may read cpu count of host machine instead of their VMs/containers.
This commit is contained in:
parent
d16f9f272b
commit
a9b1a26089
1 changed files with 11 additions and 4 deletions
|
|
@ -1,10 +1,17 @@
|
|||
import multiprocessing
|
||||
import os
|
||||
|
||||
bind = "0.0.0.0:42110"
|
||||
workers = 2
|
||||
|
||||
# Worker Configuration
|
||||
workers = int(os.environ.get("GUNICORN_WORKERS", 6))
|
||||
worker_class = "uvicorn.workers.UvicornWorker"
|
||||
timeout = 120
|
||||
keep_alive = 60
|
||||
|
||||
# Worker Timeout Configuration
|
||||
timeout = int(os.environ.get("GUNICORN_TIMEOUT", 180))
|
||||
graceful_timeout = int(os.environ.get("GUNICORN_GRACEFUL_TIMEOUT", 90))
|
||||
keep_alive = int(os.environ.get("GUNICORN_KEEP_ALIVE", 60))
|
||||
|
||||
# Logging Configuration
|
||||
accesslog = "-"
|
||||
errorlog = "-"
|
||||
loglevel = "debug"
|
||||
|
|
|
|||
Loading…
Reference in a new issue