Load Balancer Health Monitoring
Health monitors are a vital part of keeping your load-balanced environment responsive and minimizing errors in scenarios such as servers being down or over capacity. We highly recommend that you include at least a basic, connection-type health monitor for your test environments and fine-tune this monitoring for your production needs.
To follow this guide, you need to create a load balancer and add at least one node to it.
Enable health monitoring
Load Balancer health monitoring automatically adds and removes servers from the load balancer’s rotation by checking whether the server can receive traffic. You set the conditions that the health monitor uses to determine if the node is “healthy”. To set up those conditions, perform the following steps:
Select the health monitor type
On the Load Balancer Details page for the desired instance in the SpinUp Control Panel, click the Health Monitor switch to get started with configuration. Select from the following monitoring types:
- connect: Creates a simple network socket on the port that receives load balancer traffic.
- http: The load balancer’s health monitoring service performs an
HTTP GET action against a URL that you designate.
Configure health monitor details
Configure the details for your chosen monitoring type by selecting from the following options:
- delay: The number of seconds to wait before health check actions begin (between 1 and 3600).
- timeOut: The number of seconds that the monitoring service waits for a server response before flagging it as failed (between 1 and 3600).
- attempts: The number of failed tries the health monitor makes before taking the node out of rotation (between 1 and 10).
- httpPath (HTTP monitor only): The desired URL at the load balancer IP address that you want to monitor (for example:
- statusRegex (HTTP monitor only): HTTP status codes that the health montioring service should use for matching in order for the nodes to be considered healthy. This is done with regular expressions. For example
^[0-9][0-9]$is a regular expression checking for HTTP status codes 200 through 299, 300 through 399, and 400 through 499.
- bodyRegex (HTTP monitor only): A regular expression used to capture what text should be read from the body of the monitored page and used for matching to be considered healthy.
After you have the desired health monitor set up to your liking, you’re ready to click ENABLE to start monitoring. Wait until the configured delay time has passed to start seeing health checks going to the nodes. After the delay period, you can see the status of your nodes change to offline in the Load Balancer Details page when a failing health check occurs and a node is removed from rotation.
Health monitoring tips
The health monitor’s bodyRegex reads only the first 2048 bytes of text on the targeted page. You can test your page with a cURL command, such as the following example (replacing
YOUR_LB_IP_ADDRESSwith the IP address for your load balancer), to see exactly how much text is read:
curl -s -r 0-2048 https://YOUR_LB_IP_ADDRESS | head -c2048
Depending on how you monitor visitor traffic and the load your website can handle, you might prefer to point the HTTP health monitors to a small page that you set up specifically for this purpose rather than to the site’s main index.
Keep in mind that health monitoring services connect to your nodes originating from a range of different IPs. These IP addresses must be allowed through any firewalls on the nodes so that either type of health monitor can mark nodes as healthy.
Online and offline node statuses should not be confused with enabled and disabled conditions, which you set manually to manage your load-balanced cloud servers.