sidekiq taking more memory over the period? How we can solve that?

て烟熏妆下的殇ゞ 提交于 2019-12-12 04:37:43

问题


sidekiq running very long and over the period our 16GB RAM near to full. if we stop & restart the memory goes down.

Our Rails App version is Rails 3.2.12 and Ruby 1.9.3

How we can resolve this?


回答1:


This happened to me shortly after I deployed Sidekiq. It turns out I had a job that was running where the following happened:

  • It would load a spreadsheet it needed to import users
  • It was erring during the import process and dying
  • The Sidekiq worker was set to retry the job several times
  • Each retry would then fail ... but not without a large I/O operation to read the spreadsheet, store data from the uploaded spreadsheet in memory, etc.
  • My Sidekiq process ran up to 1-2 GB of RAM in a matter of an hour or so

To address it, I did the following:

  • Installed Sidekiq Failures to see the failures via a tab in the Sidekiq web interface
  • Uncovered the root of the issue and fixed it
  • Shortened the retry to 1 (from 5 or 6 ... this worked for me in terms of application rules, etc. but probably had little bearing on the issue)
  • Added better exception handling to catch and report these errors

Since fixing the issue/error in the job, my Sidekiq process has been running for 102 uninterrupted days, processed nearly 25,000 jobs (not a lot, I know) and has never gone above 700 MB (99% of the time, it sits at 678 MB).



来源:https://stackoverflow.com/questions/22510348/sidekiq-taking-more-memory-over-the-period-how-we-can-solve-that

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!