34 lines
851 B
Python
34 lines
851 B
Python
# /opt/1panel/apps/openresty/nginx/www/sites/43.142.166.152.443/django/gunicorn.conf.py
|
||
import multiprocessing
|
||
import os
|
||
|
||
bind = "127.0.0.1:8001"
|
||
|
||
# 并发 = workers × threads(gthread 比纯 sync 更抗小程序一进页多接口并发)
|
||
cpu_count = multiprocessing.cpu_count()
|
||
workers = int(os.environ.get("GUNICORN_WORKERS", max(cpu_count * 2 + 1, 4)))
|
||
threads = int(os.environ.get("GUNICORN_THREADS", 2))
|
||
worker_class = "gthread"
|
||
|
||
max_requests = 2000
|
||
max_requests_jitter = 100
|
||
|
||
timeout = 60
|
||
graceful_timeout = 30
|
||
keepalive = 5
|
||
|
||
# Django + MySQL 建议关闭 preload,避免 worker 共享陈旧 DB 连接
|
||
preload_app = False
|
||
|
||
accesslog = "-"
|
||
errorlog = "-"
|
||
loglevel = "info"
|
||
|
||
proc_name = "a_long_dianjing_gunicorn"
|
||
worker_tmp_dir = "/dev/shm"
|
||
|
||
limit_request_line = 4094
|
||
limit_request_fields = 100
|
||
limit_request_field_size = 8190
|
||
|
||
daemon = False |