Posted on

Configuring Oracle WLS Loadbalancing and High Availability

Load balancing is an essential feature of clustering. WebLogic server has specific load balancing configuration for Web applications. This can be accomplished using a software load balancer or a separate load balancing hardware.

The choice of software load balancer is indeed large and includes Oracle HTTP Server with the mod_wl_ohs module configured, Oracle WebLogic server configured with HttpClusterServlet or the open source Apache Server  mod_weblogic plugin.

For a detailed description of Oracle WebLogic plugins we suggest reading the Oracle documentation available at http://docs.oracle.com/cd/E15523_01/web.1111/e14395/toc.htm

Configuring load balancing with Oracle HTTP Server (mod_wl_ohs)

If you want to install mod_wl_ohs then you need downloading Oracle HTTP Server (http://www.oracle.com/technetwork/middleware/ias/index-091236.html) .

Oracle HTTP Server is based on the proven, open source technology of Apache Web server and includes all base Apache modules and modules developed specifically by Oracle.

Oracle HTTP Server is based on the proven, open source technology of Apache Web server and includes all base Apache modules and modules developed specifically by Oracle.

Mod_wl_ohs is built-in into Oracle HTTP server; you need however to activate it. Here’s a sample configuration file:

LoadModule weblogic_module “${ORACLE_HOME}/ohs/modules/mod_wl_ohs.so”

 

<IfModule mod_weblogic.c>

  WebLogicHost host1.com

  WebLogicPort 7001

  WLLogFile /tmp/mod_wl_ohs.log

  MatchExpression *.jsp

 

  <Location /em>

    SetHandler weblogic-handler

    WebLogicHost host1.com

    WebLogicPort 7001

  </Location>

 

</IfModule>

The main sections of mod_wl_ohs.conf are:

LoadModule: loads the weblogic_module when OHS starts.

IfModule: specifies the host and port of the WLS server or cluster and the MatchExpression for proxying by MIME type.

Location specifies application context root for proxying by path.

If both MIME type and proxying by path are configured, proxying by path takes precedence.

Configuring Load balancing with Apache server (mod_weblogic)

If you don’t want to install Oracle HTTP Server to proxy your cluster requests, an open source alternative is Apache Server’s mod_weblogic plugin. This plugin is not part of the WLS distribution so you have to download it from Oracle’s site at http://www.oracle.com/technetwork/middleware/ias/downloads/wls-plugins-096117.html

This link will download a bundle of plugins, which are in turn packaged into different operating system distributions, as shown by the following picture:

 

 

  1. Unzip the WLSPlugin which matches with your platform and locate the library named mod_wl_20.so from the package. This library needs to be copied into the APACHE_HOME\modules directory of your Apache Web server distribution.
  2. Next step will be editing Apache’s httpd.conf configuration file. Add at first the following line to your APACHE_HOME/conf/httpd.conf file manually:

LoadModule weblogic_module     modules/mod_wl_20.so

  1. Then, include an IfModule block that defines the list of servers/port in the cluster:

<IfModule mod_weblogic.c>

  WebLogicCluster w1s1.com:7001,w1s2.com:7001,w1s3.com:7001

  MatchExpression *.jsp

  MatchExpression *.xyz

</IfModule>

If you need to proxy requests by path, use the Location block and the SetHandler statement. SetHandler specifies the handler for the Apache HTTP Server Plug-in module. For example, the following Location block proxies all requests containing /weblogic in the URL:

<Location /weblogic>

  SetHandler weblogic-handler

  PathTrim /weblogic

</Location>

Choosing between mod_wl_ohs and mod_weblogic

Mod_weblogic and mod_wl_ohs provide almost the same functionalities with few notable differences: mod_wl_ohs  has support for the two-way SSL between OHS and WLS (while Mod_weblogic only supports one-way SSL) and, also, supports IPv6 for communication with WLS.