AWS autoscale ELB status checks grace period

前端 未结 3 1999
遥遥无期
遥遥无期 2021-02-20 15:34

I\'m running servers in a AWS auto scale group. The running servers are behind a load balancer. I\'m using the ELB to mange the auto scaling groups healthchecks. When servers ar

相关标签:
3条回答
  • 2021-02-20 16:19
    1. If you closely monitor your cloudformation stack events, you will get success signal that your ASG got updated.
    2. The time difference between ASG started updating and ASG received success signal is the health check grace period.
    3. This health check grace period is always recommended to have double than the application startup time. Suppose, your application takes 10 min to start, you should put health check grace period for 20 min.
    4. The reason is you never know your application might throw some kind of error and go for several retry.
    0 讨论(0)
  • 2021-02-20 16:23

    There are two types of Health Check available for Auto Scaling groups:

    • EC2 Health Check: This uses the EC2 status check to determine whether the instance is healthy. It only operates at the hypervisor level and cannot see the health of an application running on an instance.
    • Elastic Load Balancer (ELB) Health Check: This causes the Auto Scaling group to delegate the health check to the Elastic Load Balancer, which is capable of checking a specific HTTP(S) URL. This means it can check that an application is correctly running on an instance.

    Given that your system is using an ELB health check, Auto Scaling will trust the results of the ELB health check when determining the health of each EC2 instance. This can be slightly dangerous because, if the instance takes a while to start, the health check could incorrectly mark the instance as Unhealthy. This, in turn, would cause Auto Scaling to terminate the instance and launch a replacement.

    To avoid this situation, there is a Health Check Grace Period setting (in seconds) in the Auto Scaling group configuration. This indicates how long Auto Scaling should wait until it starts using the ELB health check (which, in turn, has settings for how often to check and how many checks are required to mark an instance as Healthy/Unhealthy).

    So, if your application takes 3 minutes to start, set the Health Check Grace Period to a minimum of 180 seconds (3 minutes). The documentation does not state whether the timing starts from the moment that an instance is marked as "Running" or whether it is when the Status Checks complete, so perform some timing tests to avoid any "bounce" situations.

    In fact, I would recommend setting the Health Check Grace Period to a significantly higher value (eg double the amount of time required). This will not impact the operation of your system since a Healthy Instance will start serving traffic as soon as the ELB Health Check is satisfied, which sooner than the Auto Scaling grace period. The worst case is that a genuinely unhealthy instance will be terminated a few minutes later, but this should be a rare occurrence.

    0 讨论(0)
  • 2021-02-20 16:35

    the documentation (now) states "The grace period starts after the instance passes the EC2 system status check and instance status check."

    So, at least according to the mid-2015 AWS documentation, the answer is "after the servers passed the system and the instance status checks." This is how we've set up our environment, and although I haven't done precise timings it appears to be correct.

    0 讨论(0)
提交回复
热议问题