Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zero downtime on Heroku

Is it possible to do something like the Github zero downtime deploy on Heroku using Unicorn on the Cedar stack?

I'm not entirely sure how the restart works on Heroku and what control we have over restarting processes, but I like the possibility of zero downtime deploys and up until now, from what I've read, it's not possible

There are a few things that would be required for this to work.

  1. First off, we'd need backwards compatible migrations. I leave that up to our team to figure out.
  2. Secondly, we'd want to migrate the db right after a push, but before the restart (assuming our migrations are fully backwards compatible, this should not affect anything)
  3. Thirdly, we'd want to instruct Unicorn to launch a new master process and fork some workers, then swap the PIDs and gracefully shut down the old process/workers

I've scoured the docs but I can't find anything that would indicate this is possible on Heroku. Any thoughts?

like image 382
brad Avatar asked Nov 30 '11 13:11

brad


People also ask

Does Heroku have downtime?

Heroku Preboot – A zero downtime deployment In a very simplistic way, on new deploys or changes of ENV vars, Heroku will boot your app onto new “hidden” dynos, and wait a few minutes before routing traffic to it.

How do you get 1000 Dyno hours on Heroku?

Free dyno hour pool This means you can receive a total of 1000 free dyno hours per month, if you verify your account with a credit card. Used free dyno hours are non-transferable.

How do I keep Heroku servers alive?

KeepAwake. KeepAwake is a site that pings your free Heroku apps for you. All you have to do is enter your site's name and URL and KeepAwake will send a GET request to it every 5 minutes.


1 Answers

I can't address migrations, but the part about restarting processes and avoiding wait time:

There is an beta feature for heroku called preboot. After a deploy, it boots your new dynos first and waits a while before switching traffic and killing the old ones:

https://devcenter.heroku.com/articles/labs-preboot/

I also wrote a blog post that has some measurements on my app's performance improvements using this feature:

http://ylan.segal-family.com/blog/2012/08/27/deploy-to-heroku-with-near-zero-downtime/

like image 59
Ylan S Avatar answered Oct 23 '22 09:10

Ylan S