Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

In my earlier Understanding the SAP J2EE Cookie in a Load Balanced environment I explained the structure of SAP J2EE Cookie in a Load Balanced Environment. The reason why we have to study the structure of the cookie was due to the following problem:

We were running ESS/MSS Applications (WebDynpro based) on SAP EP 7.0 (NW04s) in a Load Balanced environment with 3 physical servers. Whenever we use to login to the Portal and access the ESS/MSS Applications, it used to show up the first page properly. But when we want to navigate to the next page in the same application it used to give us the following error: ) to send the subsequent request to the same server node.

The solution to this problem is thus making sure that the Load Balancer is able to resolve the Load Balancing Cookie so that it sends the subsequent request to the same server node as the last request. This solution applies in general to all the load balancers.

Since we were using the Cisco Load Balancer, we have to configure Sticky Cookie to solve this problem. Below is the sample configuration of our load balancer.

-


configure

!*************************** GLOBAL ***************************

  ip route 0.0.0.0 0.0.0.0 10.86.191.174 1

!************************* INTERFACE *************************

interface  3/2

  bridge vlan 2

!************************** CIRCUIT **************************

circuit VLAN1

  description "client vlan"

  ip address 10.86.191.161 255.255.255.240

circuit VLAN2

  description "server vlan"

  ip address 10.1.1.254 255.255.0.0

!The string value configured in the service must match the value of

the cookie for a particular server.

!************************** SERVICE **************************

service test1

  ip address 10.1.1.1

string < server1 Dispatcher Node ID >


active

service test2
ip address 10.1.1.2

string < server2 Dispatcher Node ID >


active

service test3
ip address 10.1.1.3

string < server3 Dispatcher Node ID >


active

!The string prefix must match the cookie name. We recommend that you
include the `=' as part of the string prefix.
!*************************** OWNER ***************************
owner test

content stickyCookie
advanced-balance cookieurl
string prefix

"saplb_*="

    add service test1

    add service test2

    add service test3

    port 80

    protocol tcp

active

-


The dispatcher Node ID can be easily obtained through Visual Admin or Config Tool as explained in my earlier Understanding the SAP J2EE Cookie in a Load Balanced environment. After doing this configuration we were able to resolve the problem.

Here is my understanding of the solution. When the Load balancer sends a request to the SAP J2EE Engine for the first time for an application, along with the response, it receives a cookie from SAP J2EE engine in the following format - saplb_*=(J2EE1234500)1234550; PortalAlias=portal; JSESSIONID=( J2EE1234500) ID1111666655DB111111111111111End. To maintain the state of the application, the subsequent request from the load balancer should be sent to same dispatcher node i.e., J2EE1234500. To achieve this we need to relate the server IP Addresses to their corresponding SAP Dispatcher Node. By doing this the load balancer  will be able to identify to which IP Address it needs to send the subsequent request. So as per above configuration, our service test1 will look something like this:


service test1
ip address 10.1.1.1
string J2EE1234500
active


If incase you have multiple server nodes, to send the request to correct instance you need to add the command

string match specific first-string-found

in the configuration above. In that case the configuration will look like :


service test1
ip address 10.1.1.1
string match first-string-found J2EE1234500
active


Summary :


I have explained above the problem of session expiry in a load balanced environment. The solution is very specific to Cisco Load Balancer. But in general the concept of “sticky cookie” will apply regardless of the Load Balancer you use.

References :

http://help.sap.com/saphelp_nw2004s/helpdata/en/58/d0643e4cce3f7ce10000000a114084/frameset.htm

http://www.cisco.com/univercd/cc/td/doc/product/webscale/css/css_750/getstart/sticky.htm

9 Comments