如何确定在Heroku Performance dyno上运行的Puma工人和线程的正确数量? [英] How do I determine the right number of Puma workers and threads to run on a Heroku Performance dyno?

查看:120
本文介绍了如何确定在Heroku Performance dyno上运行的Puma工人和线程的正确数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读了关于Puoku和dyno类型的关于Heroku的所有文章,并且我无法得到直接答案。



我看到一些提及Puma工人的人数应由核心数决定。我找不到任何Heroku显示性能-M或性能-L dyno具有多少个内核的情况。

在本文中,Heroku暗示了一种方法:
https://devcenter.heroku.com / articles / deployits-rails-applications-with-the-puma-web-server

我认为他们建议将线程设置为1并且增加Puma工作者的数量,直到你开始看到R14(内存)错误,然后退出。然后增加线程数量,直到CPU达到最大值,尽管我不认为Heroku会报告CPU利用率。



任何人都可以提供指导吗?



(我也想决定是使用一个性能-L还是多个性能-M dynos,但我认为一旦我找出如何设置工作线程)

解决方案

我现在想到的路线图如下所示:


  1. heroku runcat / proc / cpuinfo--size performance -m --app yourapp

  2. heroku runcat / proc / cpuinfo - sizeize performance -l --app yourapp

  3. 记下您拥有的流程信息

  4. 使用英特尔处理器搜索模型类型,系列,型号,步骤编号以及查找此处理器具有或模拟的内核数量。看这 https://devcenter.heroku.com/articles/dynos#process-thread-limits

  5. 使用 standard- 2X / standard-1X 来确定 PUMA_WORKER 值。

  6. 做这样的数学运算:


(您想要的dyno的最大线程数类型可以支持)/(基线测试的最大线程可以支持)x(基准测试中的实验PUMA_WORKER的值) - (CPU核心数量)



例如,如果我的 standard-2X dyno中的 PUMA_WORKER 为3基准线,那么 performance-m 上的 PUMA_WORKER 数字将开始测试:



16384/512 * 3 - 4 = 92

您还应该考虑您的应用消耗多少内存,然后选择最低的内存。



编辑:以前我的回答是在 ps:exec 可用之前编写的。您可以阅读官方文档并了解如何使用ssh运行测试程序。它应该比以前更容易。


I've read all of the articles I can find on Heroku about Puma and dyno types and I can't get a straight answer.

I see some mentions that the number of Puma workers should be determined by the number of cores. I can't find anywhere that Heroku reveals how many cores a performance-M or performance-L dyno has.

In this article, Heroku hinted at an approach: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server

I think they're suggesting to set the threads to 1 and increase the number of Puma workers until you start to see R14 (memory) errors, then back off. And then increase the number of threads until the CPU maxes out, although I don't think Heroku reports on CPU utilization.

Can anyone provide guidance?

(I also want to decide whether I should use one performance-L or multiple performance-M dynos, but I think that will be clear once I figure out how to set the workers & threads)

解决方案

The roadmap I currently figured out like this:

  1. heroku run "cat /proc/cpuinfo" --size performance-m --app yourapp
  2. heroku run "cat /proc/cpuinfo" --size performance-l --app yourapp
  3. Write down the process information you have
  4. Googling model type, family, model, step number of Intel processor, and looking for how many core does this processor has or simulates.
  5. Take a look this https://devcenter.heroku.com/articles/dynos#process-thread-limits
  6. Do some small experiments with standard-2X / standard-1X to determine PUMA_WORKER value.
  7. Do your math like this:

(Max Threads of your desired dyno type could support) / (Max Threads of baseline dyno could support) x (Your experiment `PUMA_WORKER` value on baseline dyno) - (Number of CPU core)

For example, if the PUMA_WORKER is 3 on my standard-2X dyno as baseline, then the PUMA_WORKER number on performance-m I would start to test it out would be:

16384 / 512 * 3 - 4 = 92

You should also consider how much memory your app consumes and pick the lowest one.

EDIT: Previously my answer was written before ps:exec available. You could read the official document and learn how to ssh into running dyno(s). It should be quite easier than before.

这篇关于如何确定在Heroku Performance dyno上运行的Puma工人和线程的正确数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆