Using a Load Balancer with the Grid

In a grid the primary host always has a configured router (by default) which is named Default Router. All client traffic either via a browser or legacy application will be directed through this one single router.

When utilizing more than one host in the grid, it can make sense, depending on the application(s) used, to spread this client loading amongst the hosts by defining additional routers on other hosts. Similarly, it is feasible to create additional routers on the same host, distributing the load across more nodes (JVMs) and therefore potentially increasing throughput. In either case, you will have more than one entry point which the clients would need to be aware of, and to give a list of server addresses and ports to a client would be difficult to administer and make future changes onerous.

In these instances, the use of a load balancer will isolate the clients from the infrastructure. This means that the clients only have one endpoint to connect to and the load balancer holds the configuration of the entry points in the grid behind and automatically distributes the client load according to rules. Furthermore, the SSL certificate can be installed at the load balancer, meaning no requirement to distribute the SSL certificates of all the grid hosts to the clients. Again, this is a deployment choice and other options exist.

The following diagram aims to illustrate the principle of a load balancer:

Illustration: Basic load balancer setup

Various load balancers exist in the market today and are primarily in two forms:

  • Hardware

    This is a physical or virtual appliance with the sole purpose of load balancing. Many of these appliances can handle SSL offloading, meaning that SSL traffic is decrypted by the appliance, easing the load on the grid router.

  • Software

    This is software application used to load balance. Apache HTTPD is a good example of such an application and supports creating load balancing clusters with definable rules on how the load should be distributed. As an open source project, there is potentially no cost with this option. For more information, see Setting up Apache HTTPD as a proxy server.

Configuration of the load balancer will depend on the type and product selection. As such, no instructions can be documented, though the following basic steps would be followed to use a load balancer with the grid

Basic Load Balancer Setup Steps

  1. Create additional router(s) in the Grid.

    These could either be on the same host or in the case of a multi-host Grid on separate hosts though the choice depends on the desired effects.

  2. Configure the load balancer, adding each of the Grid routers to the cluster.

  3. Configure the clients to utilize the load balancer as their connection point.

One additional consideration is that context root discovery URLs may need to be configured to redirect to the load balancer, depending on the clients and whether discovery is required for any of the applications deployed. For more information about context root discovery URLs, see Working With Context Root Discovery URLs.