Posted on

Configuring Oracle WLS Loadbalancing and High Availability

 

Configuring Oracle WLS High Availability

In a cluster, the load-balancing hardware or the proxy plug-in in the Web Server, redirects the client requests to any available server in the WebLogic cluster. The cluster member that serves the request obtains a replica of the client’s HTTP session state from the available secondary Managed server in the cluster. WebLogic Server uses two methods for replicating HTTP session state across clusters:

  • In-Memory replication: WebLogic Server copies a session state from one server instance to another. The primary server creates a primary session state on the server to which the client first connects, and a secondary replica on another WebLogic Server instance in the cluster. The replica is kept up-to-date so that it may be used if the server that hosts the servlet fails.
  • JDBC-based persistence: WebLogic Server maintains the HTTP session state of a Servlet or JSP using file-based or JDBC-based persistence.

Here’s an explanation of both methods:

Configuring In-Memory replication

In-memory replication requires that web applications are deployed homogeneously on all the nodes in a cluster. Replication should be configured for each Web application within its weblogic.xml file.

When in-memory replication is enabled for a web application, WebLogic Server copies session state from one server in the cluster (primary) to one other server in the same cluster (secondary). The replica on the secondary server is kept up-to-date so that it may be used if the primary server fails.

When a client attaches to a server in the cluster and creates the primary session state, the server hosting the primary state ranks the other servers in the cluster to determine which server should host the secondary state.

Server ranks are assigned using a combination of factors such as:

  • The location of the server (resides on the same machine as the primary server?)
  • Whether or not it is a member of the preferred replication group for the primary server.

 

A replication group is a preferred list of clustered servers to be used for storing session state replicas.

As you can see from the following table, the highest rank is reserved for servers which are resident on different machines which are member of the preferred replication group:

 

Server

Rank

Server on a

different Machine

Server is a Member

of Preferred Replication Group

1

Yes

Yes

2

No

Yes

3

Yes

No

4

No

No

A replication group can be defined into each Server configuration, by clicking on theConfiguration tab of each Managed Server, and then on the Cluster subtab. From there, enter the Replication Group and Preferred Secondary Group. For example, here’s how to set the Replication Group and Preferred Secondary Group for WLSNode1:

 

The Preferred Secondary Group is the name of the replication group you would like to use to host replicated session states for this server instance.

Next, we need to enable in-memory session replication which can be done byediting your weblogic.xml configuration descriptor and adding the following:

<session-descriptor>

   <persistent-store-type>replicated</persistent-store-type>

</session-descriptor>

There are several additionalpersistent-store-typevalues which can be set; the most common is the “replicated_if_clustered”.

<session-descriptor>

   <persistent-store-type>replicated_if_clustered</persistent-store-type>

</session-descriptor>

This attribute ensures that the persistent store type will be replicated so that sessions on the clustered environment are stored in accordance with the value set for the cluster of servers to which this server belongs.