arthur-net arthur-net - 5 months ago 105
Ruby Question

sidekiq memory usage reset

I have Rails app which uses Sidekiq for background process. To deploy this application I use capistrano, ubuntu server and apache passenger. To start and restart Sidekiq I use capistrano-sidekiq gem.
My problem is - when Sidekiq is running, amount of memory (RAM) used by Sidekiq is growing up. And when Sidekiq finished all processes (workers) it keeps holding a large amount of RAM and not reseting it.

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
ubuntu 2035 67.6 45.4 3630724 1838232 ? Sl 10:03 133:59 sidekiq 3.5.0 my_app [0 of 25 busy]


How to make Sidekiq to reset used memory after workers finished their work?

Answer

I solved this problem by adding these lines to application.rb file

 config.middleware.delete "Mongoid::QueryCache"
 config.middleware.delete "ActiveRecord::QueryCache"

And memory usage does not grow anymore