A health check is a procedure used by load balancers to determine the status of a target server, ensuring that only healthy servers are kept in the load balancing rotation. Health checks can be performed using various protocols and ports, depending on the load balancer and the target server's configuration.
In the context of load balancing, health checks can be configured with different parameters, such as:
- Health Check Protocol: The protocol used when performing health checks on targets, which can be HTTP, HTTPS, or TCP.
- Health Check Port: The port on which the load balancer sends health check requests, which is typically the same port on which each target receives traffic from the load balancer.
- Health Check Path: The destination for health checks on the targets, which is usually the root path (/) by default.
- Health Check Timeout: The amount of time, in seconds, during which no response from a target means a failed health check. The default value is 5 seconds for HTTP health checks.
- Healthy ThresholdCount: The number of consecutive successful health checks required before considering an unhealthy target. The default value is 5.
- Unhealthy ThresholdCount: The number of consecutive failed health checks required before considering a target unhealthy. The default value is 2.
Health checks can be performed using different methods, such as TCP-layer health checks, which attempt to open a TCP connection on the specified port, or HTTP-layer health checks, which send an HTTP GET request to the specified URL. If the health check's protocol is TCP or HTTP, it uses the --port=80 flag for HTTP health checks and the --port=443 flag for HTTPS health checks.