ECS(Fargate)健康检查多次运行。

huangapple go评论59阅读模式
英文:

ECS (Fargate) healthcheck running multiple times

问题

我正在运行由ALB前端托管的ECS Fargate任务。与ALB关联有一个目标组,该目标组每30秒对其目标(一个ECS Fargate任务)进行健康检查。

但是,日志显示似乎每30秒会3次命中健康检查端点,详情见下方日志。

唯一我能想到的原因是VPC跨足了3个可用区,ALB也是如此。但我之前认为由于只有一个目标组(一个任务在运行),每30秒应该只会调用一次健康检查端点。这是否符合预期行为?

英文:

I am running an ECS Fargate task fronted by an ALB. There is one target group associated with the ALB which is running health-checks every 30 seconds on it's target (one ECS fargate task).

ECS(Fargate)健康检查多次运行。

However, it seems to be hitting the healtcheck endpoint 3 times every 30 seconds, see logs.

2023-06-08 09:24:29 ENDPOINT: GET /healthcheck
2023-06-08 09:24:29 ENDPOINT: GET /healthcheck
2023-06-08 09:24:29 ENDPOINT: GET /healthcheck
2023-06-08 09:23:59 ENDPOINT: GET /healthcheck
2023-06-08 09:23:59 ENDPOINT: GET /healthcheck
2023-06-08 09:23:59 ENDPOINT: GET /healthcheck
2023-06-08 09:23:29 ENDPOINT: GET /healthcheck
2023-06-08 09:23:29 ENDPOINT: GET /healthcheck
2023-06-08 09:23:29 ENDPOINT: GET /healthcheck
2023-06-08 09:22:59 ENDPOINT: GET /healthcheck
2023-06-08 09:22:59 ENDPOINT: GET /healthcheck
2023-06-08 09:22:59 ENDPOINT: GET /healthcheck

The only reason I can think of is that the VPC spans 3AZs, as does the ALB. But I thought that given there is only one target group (and one task running), there should only be one call to the healtcheck endpoint every 30 seconds? Is the expected behaviour?

答案1

得分: 2

"The only reason I can think of is that the VPC spans 3AZs, as does the ALB."

这唯一的原因我能想到的是,VPC跨越了3个可用区,正如ALB一样。

"That is exactly why you are seeing three health checks for each health check period. The health checks are coming from each AZ that the ALB is deployed to."

这就是为什么你每个健康检查周期都会看到三个健康检查的原因。这些健康检查来自ALB部署到的每个可用区。

"But I thought that given there is only one target group (and one task running), there should only be one call to the healtcheck endpoint."

但我认为,考虑到只有一个目标组(和一个任务在运行),应该只有一个对健康检查端点的调用。

"You can think of the target group like a configuration file that you are providing the load balancer. The load balancer is actually performing the health checks. And since the load balancer is deployed across multiple AZs you are getting health check requests from each of those AZs. Behind the scenes there are actually separate load balancer servers deployed in each AZ, each one performing their own health check requests."

你可以把目标组想象成你提供给负载均衡器的配置文件。负载均衡器实际上执行健康检查。由于负载均衡器部署在多个可用区,你会从每个可用区收到健康检查请求。在幕后,实际上在每个可用区部署了单独的负载均衡器服务器,每个服务器执行自己的健康检查请求。

"Is the expected behaviour?"

这是预期的行为。

英文:

> The only reason I can think of is that the VPC spans 3AZs, as does the ALB.

That is exactly why you are seeing three health checks for each health check period. The health checks are coming from each AZ that the ALB is deployed to.

> But I thought that given there is only one target group (and one task running), there should only be one call to the healtcheck endpoint

You can think of the target group like a configuration file that you are providing the load balancer. The load balancer is actually performing the health checks. And since the load balancer is deployed across multiple AZs you are getting health check requests from each of those AZs. Behind the scenes there are actually separate load balancer servers deployed in each AZ, each one performing their own health check requests.

> Is the expected behaviour?

Yes

huangapple
  • 本文由 发表于 2023年6月8日 17:37:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/76430499.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定