DEV Community

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 case ...
Collapse
 
briankephart profile image
Brian Kephart

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

Collapse
 
nicolrx profile image
nico_lrx

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

Collapse
 
ben profile image
Ben Halpern

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:

Collapse
 
nicolrx profile image
nico_lrx

Thanks Ben!

Collapse
 
codebrotha profile image
Tineyi Takawira

This just saved me so many headaches! Thanks!

Collapse
 
nicolrx profile image
nico_lrx

I'm glad it's useful!

Collapse
 
codebrotha profile image
Tineyi Takawira • Edited

I finally implemented this.

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

Thanks again!

Thread Thread
 
nicolrx profile image
nico_lrx

Thanks, I corrected it.