Django - 在heroku 1xdyno中设置WEB_CONCURRENCY太高时会发生什么

时间:2014-03-11 15:01:50

标签: django heroku concurrency gunicorn

我有一个Django个应用在Heroku中与GUnicorn一起运行,我有1Xdyno,并且发现您可以设置WEB_CONCURRENCY

什么是最佳WEB_CONCURRENCY

1 个答案:

答案 0 :(得分:2)

文章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