Configure Session Persistence

If you created a domain with Oracle WebLogic Server for OCI, and your web applications require session persistence, you can update the load balancer for the domain.

Session persistence is a method to direct all requests originating from a single logical client to a single backend server. By default, session persistence is enabled on the load balancer with the Enable load balancer cookie persistence option, but you can update the load balancer after creating a domain.

Oracle Cloud Infrastructure Load Balancing supports two types of session persistence (stickiness):

  • Application cookie persistence - The load balancer activates session persistence when a backend server sends a Set-Cookie response header containing a recognized cookie name.
  • Load balancer cookie persistence - The load balancer inserts a cookie into the response, which enables session persistence. This method is useful when you have applications that cannot generate their own cookies.

To configure session persistence:

  1. Sign in to the Oracle Cloud Infrastructure Console.
  2. From the navigation menu, click Networking, and then click Load Balancers.
  3. Select the Compartment in which the network resources for your domain were created.
    Depending on how the stack is initially created, this is the compartment that contains the compute instances and network resources for the domain, or this is the network compartment that has only the network resources for the domain.
  4. Click the name of the load balancer that's associated with your domain.
    The load balancer has -lb appended to the domain name. For example: abcde1xy-lb
  5. Click Backend Sets.
  6. Click the backend set for this load balancer.
  7. Click Edit.
  8. Modify the Session Persistence configuration.
    For example, if you select Enable Application Cookie Persistence, and set Cookie Name to '*', then responses that contain any cookie will be directed to the same server in the domain.

See these topics in the Oracle Cloud Infrastructure documentation:

Enable Session Affinity or Sticky Sessions

If you have clustered JMS resources and you access it by using an external client through a load balancer by rmi-tunneling, then you need to enable session affinity or sticky sessions.

Complete the following steps:
  1. Access the WebLogic console of the clone instance. See Access the WebLogic Console.
  2. Under Domain Structure, expand Environment > Clusters, and then click Cluster-1.
  3. In the right pane, change the Default Load Algorithm property to RoundRobinAffinity.
  4. Click Save.
  5. Restart the WebLogic Server instances.