问题
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