Memory usage increase with Ruby 2.1 versus Ruby 2.0 or 1.9

前端 未结 2 1222
醉酒成梦
醉酒成梦 2021-02-05 12:20

I recently deployed an upgrade of Ruby from 2.0 to 2.1.5 to my Heroku web application, and I am consistently hitting memory quota errors now, whereas with 2.0 and 1.9 this never

2条回答
  •  深忆病人
    2021-02-05 12:51

    This is a known issue with Ruby (versions 2.1.x) and its garbage collection. After reading couple of forums/blog posts there seems to be no real solution but to do one of the following:

    • downgrade to ruby 2.0 and wait for ruby 2.2 to be released
    • use unicorn worker killer to restart unicorn workers once they reach certain amount of memory, preventing Heroku R14 errors
    • some suggest tweaking your GC variables (see here and here)

    Here's a link to relevant discussion on ruby-lang.

    Some people also noticed that one source of the problems could be NewRelic's gem so you might want to update/remove it and see if it helps.

    Credits for some of the links and info to guys from upcase.com forum

提交回复
热议问题