Setting Up Load Balancer for SPMS OPI WebServices

SPMS OPI WebServices requires the load balancer to be configured with session persistence for it to work correctly.

Load Balancer Session Persistence or Session Stickiness

Session persistence or session stickiness is a method to direct all requests originating from a single logical client to a single backend web server.

Figure A-4 Without Session Persistence


This figure shows Without Session Persistence

Figure A-5 With Session Persistence


This figure shows With Session Persistence

Important:

As an example, we are using NGINX Plus installed on Oracle Linux as the load balancer that is configured with session persistence. You should select the right load balancer that meets your organization’s security policy.
  1. Install the Load Balancer

    Install the load balancer on the target machine. As an example, we install NGINX Plus on an Oracle Linux machine to act as a load balancer.

  2. Ensure Firewall Rules Allow HTTP/HTTPS Connection

    Ensure that the port 80 (HTTP) and port 443 (HTTPS) are enabled and not blocked by firewall.

  3. Configure the Load Balancing Method

    Generally, most load balancer supports load balancing mechanisms such as round-robin, least-connected and ip-hash. For SPMS OPI WebServices, we should use ip-hash load balancing mechanism.

    In an ip-hash load balancing mechanism, a hash-function is used to determine which server should be selected for the next request (based on the client’s IP address).

    As an NGINX Plus load balancer example, we set:

    upstream opi { 
    ip_hash;
    server <IP_ADDRESS>:<PORT>; 
    server <IP_ADDRESS>:<PORT>;
    }
  4. Configure the Session Persistence

    Session persistence means that load balancer identifies user sessions and routes all requests in a given session to the same upstream server. For SPMS OPI WebServices, we should add a session cookie to the first response from the upstream group and identifies the server that sent the response. The client’s next request contains the cookie value and the load balancer routes the request to the upstream server that responded to the first request.

    upstream opi {
    server <IP_ADDRESS>:<PORT>;
    server <IP_ADDRESS:<PORT>;
    sticky cookie sry_id expires=1h domain= oracle.com path=/;
    }

Then we should configure the load balancer to first find session identifiers by inspecting requests and responses so that it learns which upstream server corresponds to which session identifier.

As an NGINX Plus load balancer example, we set the “sticky learn” directive:

upstream opi {
server <IP_ADDRESS>:<PORT>; 
server <IP_ADDRESS>:<PORT>;
sticky learn create=$upstream_http_LogLinkID 
lookup=$http_LogLinkID 
zone=client_sessions:1m;
}