Andrew Bezzub
Andrew Bezzub

Reputation: 16032

How to find out why rails app uses a lot of memory?

I am using Heroku and today I started seeing a lot of Error R14 (Memory quota exceeded) errors. What is the best way (or tool) to track this down and find what uses up all memory?

Upvotes: 1

Views: 128

Answers (1)

Benjamin Tan Wei Hao
Benjamin Tan Wei Hao

Reputation: 9691

Install New Relic. Here you go: https://newrelic.com/.

Also, you probably want to check that you are not loading a lot of stuff via Active Record. For example, doing a Comment.all is probably not a very good idea if you have, say, 10000 comments. Instead, do something like Comment.find_in_batches which is slightly more memory friendly.

Upvotes: 2

Related Questions