Engine Yard Developer Center

HAProxy Health Check

The default load balancer for Engine Yard Cloud is HAProxy. This runs on all Application instances, but is utilised only on the Application Master instance, as DNS should be configured to resolve the application domain(s) to the Elastic IP address attached to that instance. Therefore all application traffic hits HAProxy on the Application Master instance is then load balanced out to Nginx across all Application instances in the Environment. The Chef configuration runs made when instances are provisioned, terminated and restarted ensure that the HAProxy configuration file is kept up to date with the required instances.

HAProxy uses a health check system to decide when instances are in a healthy state to accept traffic. By default this check is a simple TCP connection on the Nginx port, meaning that if Nginx is running the instance will be seen as healthy.

In certain cases, such as an instance restart or problem with the functionality, configuration or application code of a specific instance it may be the situation that Nginx is running but the application not responding. In such cases requests directed to the instance by HAProxy will fail to load successfully, timing out or returning an error response/message.

To prevent such cases we allow for the setting of a HAProxy Health Check Path. When configured, the HAProxy health check will instead utilise a HTTP request to the requested path. Any 2XX, 3XX or 503 (returned when the maintenance page is in place) response is considered healthy, whilst all other responses (including no response) are considered unhealthy and the instance pulled from the load balancing pool.

The HAProxy Health Check Path is configured at the Application level and can be set either when creating a new Application or by editing an existing Application. If editing an existing Application then an Apply will be required afterwards to update the HAProxy configuration file on the instances.

HAProxy_Health_Check.png

In order to do a holistic test of your application and database, it is recommended that the path should connect to your application and not be set to a static or cached page, though you should avoid any paths that are complex or slow to load, in order to avoid any unnecessary resource consumption. It is also recommended that if you use analytics that you exclude this path from analytics collections.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Please sign in to leave a comment.

Powered by Zendesk