首页 > 解决方案 > Python Flask 可以使用 Gunicorn 处理多少个并行请求?

问题描述

你能检查一下我是否遗漏了配置中的任何内容吗?

我正在使用 Gunicorn 运行一个 python 烧瓶应用程序。

我们目前的事件流程是:

我正在使用以下配置在 Gunicorn/Flask 上启用多处理,但这些命令没有任何效果,因为我看到作业是串行执行的,而不是并行执行的。请帮助我了解我需要更改哪些内容才能让所有这些作业并行执行。这是我尝试过但没有任何效果的命令列表:

这些命令是我尝试过的同步命令:

  1. gunicorn app1:application -b localhost:8000 --timeout 90000 -w 17
  2. gunicorn app1:application -b localhost:8000 --timeout 90000 -w 17 --threads 2
  3. gunicorn app1:application -b localhost:8000 --timeout 90000 -w 17 --threads 2 max_requests_jitter 4
  4. gunicorn app1:application -b localhost:8000 --timeout 90000 -w 17 --max-requests 4

这些命令是我尝试过的异步命令:

  1. gunicorn app1:application -b localhost:8000 --timeout 90000 -w 17 --worker-class tornado
  2. gunicorn app1:application -b localhost:8000 --timeout 90000 -w 17 --worker-class gevent
  3. gunicorn app1:application -b localhost:8000 --timeout 90000 -w 17 --worker-class gthread
  4. gunicorn app1:application -b localhost:8000 --timeout 90000 -w 17 --worker-class eventlet

标签: pythonflaskparallel-processingjmetergunicorn

解决方案


推荐阅读