flash2 / gunicorn_config.py
rkihacker's picture
Create gunicorn_config.py
4ca437f verified
raw
history blame
1.39 kB
# Gunicorn configuration file
# --- Server Socket ---
# Bind to all network interfaces on port 8000.
# This is a good default for containerized environments.
bind = "0.0.0.0:8000"
# --- Worker Processes ---
# The number of worker processes for handling requests.
# A common recommendation is (2 * number_of_cpus) + 1.
# For a 2 CPU container, this defaults to 5 workers.
workers = 5
# The type of worker to use. For an asyncio application like FastAPI,
# we use the Uvicorn worker class.
worker_class = "uvicorn.workers.UvicornWorker"
# The maximum number of simultaneous clients that a single worker can handle.
# This is a good starting point for I/O-bound applications.
worker_connections = 1000
# The maximum number of requests a worker will process before restarting.
# This can help prevent memory leaks.
max_requests = 2048
# A random jitter to the max_requests setting to prevent all workers
# from restarting at the same time.
max_requests_jitter = 512
# --- Logging ---
# The level of logging.
loglevel = "info"
# The location of the access log. "-" means log to stdout.
accesslog = "-"
# The location of the error log. "-" means log to stderr.
errorlog = "-"
# --- Process Naming ---
# A base to use with setproctitle to change the way Gunicorn processes are
# named in the process table. This affects things like `ps` and `top`.
proc_name = "fastapi_reverse_proxy"