Rails内存膨胀或泄漏?

时间:2017-08-17 14:16:29

标签: ruby-on-rails heroku memory memory-leaks

enter image description here

这是我目前在Heroku上的内存消耗。我只有一个端点,我在scout上看到被重复调用。似乎在创业期间有很多膨胀,然后它似乎在当天晚些时候停滞不前。是这样的事情表明内存泄漏?

我已经完成并更新了我用来尝试解决此错误的大部分宝石。但是,它仍然非常高,对我来说有点担心。

这是我的宝石文件。

source "https://rubygems.org"

ruby "2.3.1"

gem "rails", "5.0.1"

gem "aasm"
gem "active_model_serializers", "0.9.3"
gem "activeadmin-poro-decorator"
gem "activejob"
gem "api-auth"
gem "autoprefixer-rails"
gem "aws-sdk", "~> 2"
gem "axlsx", "2.1.0.pre"
gem "bcrypt"
gem "blanket_wrapper", require: "blanket"
gem "bootsnap"
gem "chroma"
gem "devise"
gem "dotenv-rails"
gem "dwolla_v2", "~> 1.1.2"
gem "foreman"
gem "geoip"
gem "httparty"
gem "jira-ruby", require: "jira-ruby"
gem "jquery-rails"
gem "kaminari"
gem "lightspeed_ruby", require: "lightspeed"
gem "mandrill-api", require: "mandrill"
gem "money-rails"
gem "omniauth"
gem "omniauth-lightspeed-pos"
gem "paid", git: "https://github.com/zamith/paid-ruby.git", branch: "zamith/support-pagination"
gem "paper_trail"
gem "paperclip"
gem "pg"
gem "phony_rails"
gem "puma"
gem "pundit"
gem "rack-attack"
gem "rack-cors", require: "rack/cors"
gem "roadie-rails", "~> 1.0"
gem "sidekiq"
gem "sidekiq-cron"
gem "simple_token_authentication", "~> 1.0"
gem "slack-notifier"
gem "slim-rails"
gem "stripe"
gem "textris"
gem "thor", "0.19.1"
gem "twilio-ruby"
gem "typhoeus"
gem "tzinfo-data"
gem "uglifier", ">= 1.3.0"
gem "validates_zipcode"
gem "webpacker", "~> 2.0"
gem "webpacker-react", "~> 0.3.1"
gem "wicked_pdf"
gem "wkhtmltopdf-binary"
gem "zepto-for-rails"
gem 'zip-codes'

gem "activeadmin", git: "https://github.com/activeadmin/activeadmin.git", ref: "01db1a"
gem "inherited_resources", git: "https://github.com/activeadmin/inherited_resources"

group :development do
  gem "letter_opener"
  gem "letter_opener_web"
  gem "parity"
  gem "rails-erd"
  gem "subcontractor"
  gem "web-console", "~> 2.0"
end

group :test do
  gem "capybara"
  gem "capybara-selenium"
  gem "capybara_discoball"
  gem "climate_control"
  gem "codeclimate-test-reporter", "~> 1.0.0"
  gem "database_cleaner"
  gem "fake_stripe"
  gem "fakeredis", require: "fakeredis/rspec"
  gem "pdf-reader"
  gem "rspec"
  gem "rspec-retry"
  gem "selenium-webdriver"
  gem "simplecov"
  gem "sinatra", "2.0.0.rc2"
  gem "sinatra-contrib", "2.0.0.rc2", require: false
  gem "sinatra-cross_origin"
  gem "stackprof"
  gem "timecop"
  gem "vcr"
  gem "webmock"
end

group :development, :test do
  gem "factory_girl_rails"
  gem "faker"
  gem "headless"
  gem "pry-rails"
  gem "pry-remote"
  gem "rspec-rails", "~> 3.4"
  gem "rubocop"
  gem "spring"
  gem "spring-commands-rspec"
end

group :production, :staging do
  gem "oj"
  gem "rails_12factor"
  gem "rollbar"
  gem "scout_apm"
end

我在解释这是内存泄漏还是内存膨胀时遇到问题。

2 个答案:

答案 0 :(得分:0)

试试'Derailed Benchmarks'宝石。我注意到,在运行我的时候,twilio-ruby宝石是21MB最大的记忆猪之一。

https://github.com/schneems/derailed_benchmarks

答案 1 :(得分:0)

这篇文章发表两年后,这颗宝石似乎是一个持续存在的问题。

我自己正在遇到与此宝石有关的内存问题。

出轨基准 twilio-ruby:19.0 MiB

在解决此问题时,您可以在此处跟踪进度。 https://github.com/twilio/twilio-ruby/issues/396