加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Heroku Rails 4 Puma应用程序产生了额外的实例

发布时间:2020-12-17 02:23:26 所属栏目:百科 来源:网络整理
导读:我正在使用Puma配置在Heroku上运行基本的Rails 4( ruby 2.1.4)应用程序,如下所示: workers Integer(ENV['PUMA_WORKERS'] || 1)threads Integer(ENV['MIN_THREADS'] || 6),Integer(ENV['MAX_THREADS'] || 6) 我目前没有设置任何ENV变量,所以我应该默认为1名
我正在使用Puma配置在Heroku上运行基本的Rails 4( ruby 2.1.4)应用程序,如下所示:

workers Integer(ENV['PUMA_WORKERS'] || 1)
threads Integer(ENV['MIN_THREADS']  || 6),Integer(ENV['MAX_THREADS'] || 6)

我目前没有设置任何ENV变量,所以我应该默认为1名工人.

问题是,在调查潜在的内存泄漏时,似乎我的web.1 dyno的2个’实例’正在运行,至少根据NewRelic.

我有heroku实验室:启用了log-runtime-metrics,它显示我的内存占用大约400MB.在NewRelic上,它显示我的足迹在2个’实例’的~200MB AVG.

heroku:ps显示:

=== web (1X): `bundle exec puma -C config/puma.rb`
web.1: up 2014/10/30 13:49:29 (~ 4h ago)

那么为什么NewRelic认为我有2个实例在运行?如果我做了一个heroku:重新启动NewRelic只会看到一个实例一段时间然后碰到2.这是Heroku正在做的事情,但没有报告给我,或者它是Puma的东西,即使工人应该设置为1.

解决方法

请参阅2015年2月17日版本的 New Relic 3.10.0.279,该版本在跟踪Puma实例时解决了此特定问题.我猜你的应用程序在Heroku上运行,你有preload_app!在你的Puma配置中设置,所以这应该适用.

从发行说明:

Metrics no longer reported from Puma master processes.
When using Puma’s cluster mode with the preload_app! configuration directive,the agent will no longer start its reporting thread in the Puma master process. This should result in more accurate instance counts,and more accurate stats on the Ruby VMs page (since the master process will be excluded).

我正在测试具有类似问题的项目的更新,似乎更准确地报告.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读