Essentially healthchecking works by requesting something and examining the response. Healthchecking can be done at different layers of the TCP/IP stack. The higher in the stack, the better the quality of the healthcheck at determining overall application health.
At Layer 3, LoadMaster can use ICMP Ping. This will send a ping request to the server. If we receive a ping response, the server is considered healthy. This however only checks that the server is running, not the application.
At Layer 4, LoadMaster can use TCP Connection. This will attempt to open a TCP connection to the server on the selected port. If the server completes the TCP handshake, the server is considered healthy. This checks that the application is at least accepting connections, but does not check that the application is functioning properly.
At Layer 7, there are a variety of protocol specific healthchecks. These will open a TCP connection to the server and begin application level communication. Once the server responds with good data, the server is considered healthy. This checks that the application is up and functioning properly.
For HTTP and HTTPS healthchecks, you can specify some of the parameters used to make the request. These parameters are URL, method, version, hostname as well as additional headers. These parameters are assembled as follows:
<Method> <URL> HTTP/<Version>
If HTTP/1.1 is specified, you can also set the hostname as a header if your server requires this.
<Method> <URL> HTTP/<Version> Host: <Hostname>
The default healthcheck looks like this:
HEAD / HTTP/1.0
Using the following settings, the healthcheck would look like this:
Method: GET URL: /healthcheck.html Version: 1.1 Hostname: example.com
GET /healthcheck.html HTTP/1.1 Host: example.com
If LoadMaster receives a 200, 301, 302 or 401 status code as a response, the server is considered healthy. You can get more granular if you specify the method to be GET. You can then specify a regular expression which is compared to the first 4KB of the response. If it matches, the server is considered healthy. This feature requires a 200 response code with content to be returned.