Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sidekiq is not releasing the memory after finishing the job

I am facing some strange issue with Sidekiq, I have a few heavy jobs running in the background with Sidekiq. but even after Sidekiq finished the job it's still holding the memory. what could be the reason? Versions

ruby : 2.2.4
rails : 4.2.7
sidekiq : 3.5.4

enter image description here I have attached the memory log also. Even I haved check the link but it couldn't help. I have even manually started the GC also.

like image 929
Sabyasachi Ghosh Avatar asked Mar 05 '23 16:03

Sabyasachi Ghosh


1 Answers

My understanding is that Ruby MRI will not release memory back to the OS. If your Sidekiq job consumes a lot of memory, even if those objects are garbage collected, the memory will just be released back to Ruby, not back to the OS. You should try to find a way to make your Sidekiq job(s) consume less memory, and assume that your workers will eventually allocate the maximum amount of memory that your most memory-consuming job requires.

like image 57
Jim Ryan Avatar answered Mar 16 '23 04:03

Jim Ryan