代码之家  ›  专栏  ›  技术社区  ›  Aleksa Bajat

为什么gunicorn不能利用更多的员工(谷歌应用程序引擎)?

  •  0
  • Aleksa Bajat  · 技术社区  · 1 年前

    在文档中,您可以找到 https://cloud.google.com/appengine/docs/flexible/python/runtime 。 它说,没有设置多个工人的gunicorn.conf.py可能会增加延迟,因为默认工人数量是1(一个工人800毫秒时延迟确实会很高)。然而,遵守建议的gunicorn设置会使响应时间增加4秒,有时甚至无法实现。 我的入口点: entrypoint: gunicorn -c gunicorn.conf.py -b :$PORT main:app

    一名工人的切入点: entrypoint: gunicorn -b :$PORT main:app

    可能是什么问题?

    0 回复  |  直到 1 年前
        1
  •  1
  •   Sandeep Vokkareni    1 年前

    Stackoverflow Link 作者:Christopher Rodriguez Conde,

    只要您遵循推荐的app.yaml入口点的文档,您实际的gunicorn.conf.py配置可能使用 sync workers

    我建议使用异步工作者,根据 Gunicorn documentation ,“可用的异步工作者基于Greenlets(通过Eventlet和Gevent)”,您现在拥有的同步工作者一次处理一个请求。

    如前所述 here ,如果您的worker类需要额外的依赖项,如gevent或toronto,则需要在应用程序的 requirements.txt

    还要确保 requirements.txt 您已经为添加了指定的版本 gunicorn 如前所述 here