Memory constantly increasing in Rails app

前端 未结 2 1620
夕颜
夕颜 2021-02-04 11:53

I recently launched a new Ruby on Rails application that worked well in development mode. After the launch I have been experiencing the memory being used is constantly increasin

2条回答
  •  长情又很酷
    2021-02-04 12:16

    Assuming category_from_feed returns a string (or a symbol perhaps), a magnitude of 300MB increase is quite unlikely. You can roughly arrive at this by profiling this:

    4_000_000.times {related_feed_categories << "Loooooooooooooong string" }
    

    This snippet would shoot the memory usage up by about 110MB.

    I'd look at DB connections or methods that read a file and then don't close it. I can see that it's related to feeds which probably means you might be using XML. That can be a starting point too.


    Posting this as answer because this looks bad in comments :/

提交回复
热议问题