在处理一些高并发任务的接口时,选择FastAPI会相对更合适
[supervisord]
minfds=65536
minprocs=32768[fcgi-program:uvicorn12001]
# 定义临时变量通过os.getenv('JCSP_DEPLOY_ENV', 'local')可以获取
environment=JCSP_DEPLOY_ENV="beta"
socket=tcp://0.0.0.0:12001
command = /usr/local/bin/uvicorn --fd 0 xxx:app
directory = /data/gofish-interface/src
# 开启4个进程处理
numprocs=4
process_name=uvicorn-%(process_num)d
user = root
startsecs = 3
redirect_stderr = true
stdout_logfile_maxbytes = 50MB
stdout_logfile_backups = 10
stdout_logfile = /var/lib/docker/containers/xxx/api.log
参考:https://www.uvicorn.org/deployment/#supervisor