Sun GlassFish Enterprise Server 2.1 High Availability Administration Guide

Creating the HTTP Health Checker

The load balancer’s health checker periodically checks all the configured Enterprise Server instances that are marked as unhealthy. A health checker is not required, but if no health checker exists, or if the health checker is disabled, the periodic health check of unhealthy instances is not performed. The load balancer will not be able to determine when an unhealthy instance becomes healthy.

The load balancer’s health check mechanism communicates with the instance using HTTP. The health checker sends an HTTP request to the URL specified and waits for a response. A status code in the HTTP response header between 100 and 500 means the instance is healthy.


Note –

If you have a deployment scenario where the load balancer is the front–end for a cluster that has instances using a secured port with client certificate authentication enabled, the health checker will not be able to perform a health check of the instances. Hence, those instances will always be marked unhealthy and no requests will be sent to them.


Creating a Health Checker

To specify the health checker properties, you can use the Admin Console or the asadmin create-http-health-checker command. To do this in the Admin Console, navigate to the HTTP Load Balancers node, expand it and select the load balancer. Then, open the Target tab, and in the Targets table, click the Edit Health Checker link for the desired target. Specify the following parameters.

Table 5–2 Health Checker Parameters

Parameter 

Description 

Default 

Load Balancer 

Click the Enabled check box to make the selected server available for load balancing. 

False/Disabled 

Disable Timeout 

The amount of time, in minutes, this server takes to reach a quiescent state after having been disabled . 

30 minutes 

url 

Specifies the listener’s URL that the load balancer checks to determine its state of health.  

“/” 

interval 

Specifies the interval in seconds at which health checks of instances occur. Specifying 0 disables the health checker. 

30 seconds 

timeout 

Specifies the timeout interval in seconds within which a response must be obtained for a listener to be considered healthy.  

10 seconds 

If an instance is marked as unhealthy, the health checker polls the unhealthy instances to determine if the instance has become healthy. The health checker uses the specified URL to check all unhealthy instances to determine if they have returned to the healthy state.

If the health checker finds that an unhealthy instance has become healthy, that instance is added to the list of healthy instances.

For more information see the documentation for create-http-health-checker and delete-http-health-checker.

Additional Health Check Properties for Healthy Instances

The health checker created by create-http-health-checker only checks unhealthy instances. To periodically check healthy instances, set some additional properties in your exported loadbalancer.xml file.


Note –

These properties can only be set by manually editing loadbalancer.xml after you’ve exported it. There is no equivalent asadmin command to use.


To check healthy instances, set the following properties.

Table 5–3 Health-checker Manual Properties

Property 

Definition 

active-healthcheck-enabled

True/false flag indicating whether to ping healthy server instances to determine whether they are healthy. To ping server instances, set the flag to true. 

number-healthcheck-retries

Specifies how many times the load balancer’s health checker pings an unresponsive server instance before marking it unhealthy. Valid range is between 1 and 1000. A default value to set is 3. 

Set the properties by using the asadmin set command. For example:

asadmin set domain.lb-configs.load-balancer-config.property.active-healthcheck-enabled=true

asadmin set domain.lb-configs.load-balancer-config.property.number-healthcheck-retries=5

If you add these properties, then subsequently edit and export the loadbalancer.xml file again, the newly exported configuration won’t contain these properties. You must add these properties again to the newly exported configuration.