服务结构应用程序运行状况检查 [英] Service Fabric Application Health Check

查看:96
本文介绍了服务结构应用程序运行状况检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以定期检查应用程序的运行状况?我想到了两种情况:

Is it possible to periodically check the health of an application? I have two scenarios in mind:

  • 在部署过程中,如果运行状况检查失败,我希望服务结构回滚
  • 应用程序已成功运行,但仍希望定期运行运行状况检查,以防依赖项不可用

当前,我公开了healthcheck操作,并且有流量管理器对其进行轮询.我将其标记为不健康.

Currently I expose a healthcheck operation and I have traffic manager polling it. I have the following to flag it as unhealthy..

var context = FabricRuntime.GetActivationContext();
context.ReportApplicationHealth(new HealthInformation("source", "healthcheck", HealthState.Error));

这可行,但是我希望添加一个运行状况检查策略,该策略将定期轮询此终结点,而不是依赖于外部组件.另外,从部署的角度来看,我希望它在例如应用程序无法启动(缺少配置,DI配置错误等)时回滚.

This works but I was hoping to add a health check policy which will poll this endpoint periodically as opposed to relying on an external component. Also, from a deployment perspective I want it to rollback if for example the app failed to start (missing config, DI misconfigured etc).

我在这里吠错树了吗?我以为这些健康检查策略会满足我的需求,但是不确定如何配置它..

Am I barking up the wrong tree here? I am assuming these health check policies will give me what I need but unsure how to configure it..

推荐答案

我建议使用边车模式".您将部署专门用于监视其他服务的服务. 看门狗"服务将能够定期ping/检查另一个并报告其运行状况.

I'd recommend using the 'side-car pattern'. You'd deploy a service dedicated to monitoring the other service. The 'watchdog' service would be able to ping /check the other periodically and report about its health.

通过委派监视工作,即使受保护的服务停止了全部响应,例如在无休止的等待中,您也可以检测并报告服务的运行状况.

By delegating the monitoring work, you can detect and report service unhealthiness even if the guarded service stops responding all together, for example when it's caught in a never ending wait.

我找到了一些有关此主题的链接,这些链接可能会有所帮助:

I've found a few links about this topic that may be helpful:

  • This page
  • And this one.

这篇关于服务结构应用程序运行状况检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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