feat: gunicorn config
This commit is contained in:
parent
8582daf4c0
commit
3b464983ce
1 changed files with 29 additions and 0 deletions
29
systemd/gunicorn.conf.py
Normal file
29
systemd/gunicorn.conf.py
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
# Gunicorn configuration for FastAPI
|
||||||
|
import multiprocessing
|
||||||
|
|
||||||
|
# Server socket
|
||||||
|
bind = "127.0.0.1:8000"
|
||||||
|
backlog = 2048
|
||||||
|
|
||||||
|
# Worker processes
|
||||||
|
# Rule of thumb: (2 * CPU cores) + 1
|
||||||
|
workers = multiprocessing.cpu_count() * 2 + 1
|
||||||
|
worker_class = "uvicorn.workers.UvicornWorker"
|
||||||
|
worker_connections = 1000
|
||||||
|
timeout = 30
|
||||||
|
keepalive = 2
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
accesslog = "/var/log/karl/access.log"
|
||||||
|
errorlog = "/var/log/karl/error.log"
|
||||||
|
loglevel = "info"
|
||||||
|
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" %(D)s'
|
||||||
|
|
||||||
|
# Process naming
|
||||||
|
proc_name = "karl"
|
||||||
|
|
||||||
|
# Graceful shutdown
|
||||||
|
graceful_timeout = 30
|
||||||
|
|
||||||
|
# Preload app for faster worker spawning
|
||||||
|
preload_app = True
|
||||||
Loading…
Add table
Add a link
Reference in a new issue