mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 05:29:12 +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:
@@ -1,10 +1,17 @@
|
|||||||
import multiprocessing
|
import os
|
||||||
|
|
||||||
bind = "0.0.0.0:42110"
|
bind = "0.0.0.0:42110"
|
||||||
workers = 2
|
|
||||||
|
# Worker Configuration
|
||||||
|
workers = int(os.environ.get("GUNICORN_WORKERS", 6))
|
||||||
worker_class = "uvicorn.workers.UvicornWorker"
|
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 = "-"
|
accesslog = "-"
|
||||||
errorlog = "-"
|
errorlog = "-"
|
||||||
loglevel = "debug"
|
loglevel = "debug"
|
||||||
|
|||||||
Reference in New Issue
Block a user