How to Easily Avoid Hitting the Memory Limit on Heroku

nico_lrx on April 12, 2018

Heroku is a great tool to launch a new app easily. However, dynos can quickly reach their limit if your app is memory intensive. It was the cas... [Read Full]
markdown guide
 

It's my first post here (and one of my first technical post ever), please let me know if you have any feedback ;)

 

This is just the kind of post I would have loved to have found while dealing with this issue myself.

For further on this subject, this talk is great:

 
 

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. 😢

 
 
 

I finally implemented this.

By the way t = Time.now.day.strftime('%H') should be t = Time.now.strftime('%H').

Thanks again!

code of conduct - report abuse