Heroku零停机 [英] Zero downtime on Heroku

查看:176
本文介绍了Heroku零停机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用Unicorn在Heroku上执行诸如 Github零宕机时间部署之类的操作雪松堆栈?



我并不完全确定重启Heroku的过程是如何进行的,以及我们对重启进程有何控制,但我喜欢直到目前为止零宕机时间的可能性,从我读过的,这是不可能的



这项工作需要做一些事情。


  1. 首先,我们需要向后兼容的迁移。其次,我们希望在推送后立即迁移数据库,但在重新启动之前(假设我们的迁移完全向后兼容,这应该不会影响任何东西)第三,我们希望指示Unicorn启动一个新的主进程并分派一些工作者,然后交换PID并正常关闭旧的进程/员工

我搜遍了这些文档,但是找不到任何可能表明Heroku可以使用的文档。任何想法?

解决方案

我无法解决迁移问题,但关于重新启动进程和避免等待时间的部分:



heroku有一个名为preboot的测试版功能。部署完成后,它会首先启动新的dynos,然后等待一段时间,然后再切换流量并杀死旧的流量: https://devcenter.heroku.com/articles/labs-preboot/



我也写了一个博客文章对我的应用使用此功能的性能进行了一些测量: b
$ b

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


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?

解决方案

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/

这篇关于Heroku零停机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆