【问题标题】:Django - What happens when setting WEB_CONCURRENCY too high in heroku 1xdynoDjango - 在heroku 1xdyno中将WEB_CONCURRENCY设置得太高时会发生什么
【发布时间】:2014-04-15 06:58:53
【问题描述】:

我有一个Django 应用程序在Heroku 和GUnicorn 中运行,我有1Xdyno,刚刚发现你可以设置你的WEB_CONCURRENCY。

最佳WEB_CONCURRENCY 是什么?

【问题讨论】:

    标签: django heroku concurrency gunicorn


    【解决方案1】:

    文章 Deploying Python Applications with Gunicorn 讲述了 Gunicorn 的各种参数及其对 Heroku 的影响。

    以下是从这篇文章中复制的关于WEB_CONCURRENCY的文字

    Gunicorn forks multiple system processes within each dyno to allow a Python app to support multiple concurrent requests without requiring them to be thread-safe. In Gunicorn terminology, these are referred to as worker processes (not to be confused with Heroku worker processes, which run in their own dynos).

    Each forked system process consumes additional memory. This limits how many processes you can run in a single dyno. With a typical Django application memory footprint, you can expect to run 2–4 Gunicorn worker processes on a 1X dyno. Your application may allow for a variation of this, depending on your application’s specific memory requirements.

    We recommend setting a configuration variable for this setting, so you can tweak it without editing code and redeploying your application.

    $ heroku config:set WEB_CONCURRENCY=3
    

    【讨论】:

      猜你喜欢
      • 2015-02-26
      • 1970-01-01
      • 2020-03-17
      • 1970-01-01
      • 1970-01-01
      • 2013-04-19
      • 2020-02-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多