Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Controlling Heroku's random dyno restarts

Tags:

heroku

According to "Are the dyno restarts on Heroku simultaneous?", Heroku restarts dynos randomly throughout the day, and only gives 10 seconds after SIGTERM for the processes to finish up.

We have long-running processes running on Heroku. Is it possible to force Heroku to prevent each dyno from receiving new requests longer than 10 seconds (e.g. 10 minutes) before restarting that dyno?

like image 950
maxko87 Avatar asked Oct 30 '14 23:10

maxko87


1 Answers

Is it possible to force Heroku to prevent each dyno from receiving new requests longer than 10 seconds

No.

The Dyno Manager restarts your dyno(s) when:

  • you create a new release by deploying new code
  • change your config vars
  • changing your add-ons
  • when you run heroku restart
  • at least once per day, in addition to being restarted as needed for the overall health of the system and your app

See here:

  • Heroku Devcenter: Dynos and the Dyno Manager

Regarding the answer in the post you shared:

Heroku restarts dynos randomly -- sometimes multiple times per day. Don't count on it being simultaneous!

That's a bit misleading; Heroku restarts your dynos approximately once every 24 hours. It is per dyno, not per app, and so they should not coincide. If a dyno crashes, it can be restarted, and the 24 hour period is reset (basically; it's a new dyno, new cycle).

like image 99
catsby Avatar answered Oct 22 '22 14:10

catsby