Azure WebJobs-托管在哪里?它们像长期运行的流程一样安全吗? [英] Azure WebJobs - where hosted? Are they safe as long-running processes?

查看:69
本文介绍了Azure WebJobs-托管在哪里?它们像长期运行的流程一样安全吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Azure WebSite始终在线我假定Azure WebJobs托管在IIS中,并使用IIS资源(以及我们的网站资源).

From Azure WebSite Always On and Meaning of "Always On" setting on Azure Web Site I assume that Azure WebJobs are hosted in IIS and uses IIS resources (and this our website resources).

此外,在定价页面中: http://azure.microsoft .com/en-us/pricing/details/websites/上有一条声明:

Furthermore, in the pricing page: http://azure.microsoft.com/en-us/pricing/details/websites/ there is a statement:

按需,按计划运行自定义可执行文件和/或脚本,或者 作为您网站实例中的后台任务连续进行. 连续WebJobs执行需要Always On.蔚蓝 计划的WebJob必须使用Scheduler Free或Standard.

Run custom executables and/or scripts on demand, on a schedule, or continuously as a background task within your Websites instance. Always On is required for continuous WebJobs execution. Azure Scheduler Free or Standard is required for scheduled WebJobs.

因此,我认为这是对的.实际上,Azure WebJobs托管在Azure网站的IIS中.注意:WebJobs可以是连续的并且可以长时间运行.

Therefore I assume that is true. Indeed Azure WebJobs are hosted in Azure Website's IIS. Note: WebJobs can be continuous and long running.

但是,让我担心的是,执行长时间运行的进程/后台进程通常被视为反模式:

However, what worries me then, is that executing long running processes/background processes is often seen as anti-pattern:

  • Can I use threads to carry out long-running jobs on IIS?
  • Concerns with long-running process on IIS
  • ASP.NET long running task. Thread is being aborted exception

那么Microsoft Azure是否提出一些似乎是反模式的东西?另一个问题:然后将Quartz.NET作为连续任务运行并具有免费的"简单后台任务调度是一个好主意吗?

So does Microsoft Azure propose something, which seems to be anti-pattern or not? Additional question: would it be a good idea then to run Quartz.NET as continuous task and have "free" simple background task scheduling?

推荐答案

我将尝试分别解决您的两个问题.

I'll try to address your two questions separately.

给定的WebJob位于Web应用程序(或Mobile/API App)中.每个站点都运行着一个Kudu实例,该实例管理诸如部署,IIS和对我们而言很重要的WebJobs之类的东西.因此,它托管在Web App中,但不一定由IIS管理,它由管理IIS for Web Apps的同一事物管理.您可以在 Kudu GitHub 中查看所有这些信息.

A given WebJob lives inside a Web App (or Mobile/API App). Each site has a Kudu instance running which manages things like deployments, IIS, and, important for us, WebJobs. So it is Hosted in a Web App, but it isn't necessarily managed by IIS, it's managed by the same thing that manages IIS for Web Apps. All this is available for review by you in the Kudu GitHub.

它们与任何长期运行的过程一样安全,因为它们不是一个人运行.如果您只是将控制台应用程序作为连续作业上载并使其在while循环中运行,则它可能会由于任何原因随时崩溃.启用始终在线"功能后,Kudu将始终保持清醒状态,以重新启动它.

They're about as safe as any long running process, in that they aren't by themselves. If you just upload a console app as a continuous job and have it running in a while loop, it may crash at any time for any reason. With 'Always On', Kudu will always be awake to start it up again.

如果您想确保事情会被执行且不会丢失,请尝试查看

If you want some amount of assurance that things will be executed and not lost, try taking a look at the WebJobs SDK. It will actually track fail/success for Jobs and uses a Storage Queue to track history, allowing for retry and normal patterns for processing like poison messages, etc.

这篇关于Azure WebJobs-托管在哪里?它们像长期运行的流程一样安全吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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