Thanks for this post! That gem looks handy.
For those running Rails & Puma, the gem puma_worker_killer can do this as well. The nice thing about that one is it will restart your dynos sequentially to avoid downtime.
I once made a pull request to puma_worker_killer to use the Heroku log drain to measure memory use and restart if it gets too high. Sadly, it didn’t get merged. 😢
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.