简体   繁体   English

自动化Azure VIP交换

[英]Automating Azure VIP Swap

I have an ASP.NET MVC 4 app hosted as an Azure web role. 我有一个ASP.NET MVC 4应用程序托管为Azure Web角色。 I want to do something that seems like it should be pretty standard: I want to create a function that I can call that initiates a VIP swap and raises and event (or calls a callback) when the VIP Swap operation is done. 我想做一些看起来很标准的事情: 我想创建一个我可以调用的函数,该函数在VIP交换操作完成后启动VIP交换并引发和事件(或调用回调)。

Just to add some context to the situation: My website implements a workflow that takes about an hour (or less) to complete. 只是为了增加一些情况:我的网站实施的工作流大约需要一个小时(或更短的时间)才能完成。 If I want to release a new version of the website code, it's convenient (ie much less "backward compatibility" code to write) to first let all of the current users complete the workflow so that the new code doesn't need to deal with data created by the previous version of the code. 如果我要发布新版本的网站代码,首先让所有当前用户完成工作流程就很方便(即编写的“向后兼容性”代码要少得多),这样就不需要处理新代码了。先前版本的代码创建的数据。 So a management function in my website would first poke a value into the database that disables new workflows; 因此,我网站上的管理功能会首先在数据库中戳入一个值,以禁用新的工作流程; it would then wait until all current workflows are done; 然后它将等待所有当前工作流程完成; it would then call the "VIP Swap" routine; 然后它将调用“ VIP交换”例程; finally, when the VIP Swap routine signals its completion, it would poke the database value to re-enable new workflows. 最终,当VIP交换例程发出完成信号时,它将拨出数据库值以重新启用新的工作流程。

I found the Microsoft documentation for how to programmatically initiate a VIP swap here: http://msdn.microsoft.com/en-us/library/ee460814.aspx 我在这里找到了有关如何以编程方式启动VIP交换的Microsoft文档: http : //msdn.microsoft.com/zh-cn/library/ee460814.aspx

The procedure involves POSTing to a magic URL and including some headers in the POST, then periodically performing a GET to a magic URL and checking the response code. 该过程包括将内容发布到魔术URL并在POST中包含一些标头,然后定期执行对魔术URL的GET并检查响应代码。

The more I think about this, the more non-trivial it seems. 我对这个问题的思考越多,它看起来就越平凡。 In addition to the basic complexities of wiring up a background timer and completion notification, I don't know what complexities, if any, I might run into trying to do this stuff in the IIS environment. 除了连接后台计时器和完成通知的基本复杂性外,我不知道有什么复杂性(如果有的话)会尝试在IIS环境中执行此操作。 Can I even perform HTTP operations on a background thread? 我什至可以在后台线程上执行HTTP操作吗? For that matter, will I run into complications just trying to use any of the half dozen or so different "do things in the background" mechanisms baked into .NET? 就此而言,我是否会尝试使用混入.NET的六种左右不同的“后台处理”机制中的任何一种而遇到麻烦?

Any help or guidance will be greatly appreciated. 任何帮助或指导将不胜感激。 In particular, I'd be ecstatic if someone could point me at a ready-to-go implementation of this function! 特别是, 如果有人可以指出我该功能的现成实现我会欣喜若狂!

I don't think you will find an easy solution to this as the fabric controller is setup to do some very fancy things without your involvement. 我不认为您会找到一个简单的解决方案,因为结构控制器可以在您不参与的情况下做一些非常漂亮的事情。 Running hour-long workflows on a cloud computing environment, where an instance can be pulled out from underneath you, (with a maximum of 5 minutes from the OnStopping event being called to clean up) requires that you do other work anyway to make sure that all of your tasks complete. 在云计算环境上运行一个小时的工作流(可以从您的下方拉出一个实例)(从调用OnStopping事件最多需要5分钟以进行清理)需要无论如何都要进行其他工作,以确保您的所有任务都已完成。

The simple question is "What do you do if an instance goes down when workflows are still running?" 一个简单的问题是“如果在工作流仍在运行时实例发生故障,您该怎么办?” Do you restart them or are they lost? 您重新启动它们还是丢失? If they get lost then you don't care anyway, so killing workflows for an upgrade are equally unimportant. 如果它们迷路了,那么您无论如何都不在乎,因此终止升级工作流也同样不重要。 If you re-start them then use that same mechanism to decide whether or not a node is due to be shut down, and distribute the jobs accordingly. 如果重新启动它们,则使用相同的机制来确定是否应关闭节点,并相应地分配作业。 This pattern is eerily similar to the Hadoop JobTracker . 这种模式与Hadoop JobTracker非常相似。 Don't just run the workflows on any 'ol instance. 不要只在任何'ol实例上运行工作流程。 Submit them to a (job tracker) service that decides what to do. 将它们提交给(作业跟踪器)服务,以决定要做什么。 The (job tracker) service can then use the service management API to scale up as many instances as you need running the version that you want, run workflows on the appropriate node, and shut them down when they are no longer needed or are outdated. 然后,(作业跟踪器)服务可以使用服务管理API来按需要扩展任意数量的实例,以运行所需的版本,在适当的节点上运行工作流,并在不再需要或过时时关闭它们。

Unfortunately this may not be the simple solution that you are looking for, but something in your architecture needs to change, rather than trying to force PaaS to fit with your current approach. 不幸的是,这可能不是您想要的简单解决方案,但是架构中的某些事情需要改变,而不是试图迫使PaaS适应当前的方法。 Decompose your workloads, create loosely coupled services, design for failure, and a few other cloud/distributed computing practices need to be considered. 分解您的工作负载,创建松耦合的服务,针对故障进行设计,还需要考虑其他一些云/分布式计算实践。 There is a reason why Hadoop is built the way that it is — and it has a reputation for being able to get work done on a bunch of somewhat unreliable commodity hardware. 建立Hadoop的原由是有原因的-它以能够在一些不太可靠的商品硬件上完成工作而闻名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure部署插槽交换重定向到同一个域 - Azure Deployment Slot swap redirects to same domain Azure阶段部署:实体框架代码优先迁移未执行交换 - Azure Staged deployment : Entity Framework Code First Migrations not executed of swap “您无权查看此目录或页面。”仅在交换到Azure上的生产后才出错 - “You do not have permission to view this directory or page.” Error only after swap into production on Azure 在MVC应用程序上自动执行防伪标记验证 - Automating Anti Forgery Token Validation on MVC Apps 使用预览“完成交换”步骤进行交换重新启动生产槽 - Swap with preview 'Complete Swap' step restarts production slot / Help页面上的自动化ASP MVC.NET Web API文档 - Automating ASP MVC.NET Web api documentation on the /Help page Mvc Contrib便携式区域-换出总线? - Mvc Contrib Portable areas - swap out the bus? 在ValidationMessageFor Method Dynamicaly中将英语交换为西班牙语 - Swap English to Spanish in ValidationMessageFor Method Dynamicaly 在MVC路由和Durandal路由之间交换 - Swap between MVC routing and Durandal routing 是否可以在按钮点击时“交换”部分视图? - is it possible to 'Swap' partial views on a button click?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM