Testing session management

As described before, there are three ways of tracking session management:
Cookies
SSL ID
URL rewriting

 

Cookies

We tested session affinity using cookies as follows:

1. In the plugin-cfg.xml file, change the Log tag. Set the Log tag so that the line looks similar to:

<Log LogLevel="Trace" Name="C:\WebSphere\AppServer\logs\sesstrace.log"/>

2. Save and close the plugin-cfg.xml file.

3. In the Administrative Console, click Servers -> Application Servers.

4. Click <AppServer Name>. In this example, PluginMember1 is selected.

5. Click Web Container -> Session Management. The window shown in Figure 5-17 will appear.

6. Check the Enable Cookies check box.

7. Synchronize the nodes and then repeat step 1 to 4 for the other appservers in the cluster. In our case, also PluginMember2 has to be updated.

Figure 5-17 Setting Cookies for session management.

8. Stop and start the cluster to make the session manager changes operational.

9. Open a browser and go to:

http://<yourWebServer>/hitcount

10. Select Session state from the Generate hit count using options, as shown in Figure 5-18.

Figure 5-18 HitCount servlet

11. Click the Increment button a few times.

12. Open your plug-in log as specified in step 1. Look through the processing of the requests and search for websphereHandleSessionAffinity.

You should see something similar to that shown in Example 5-14.

Note: If the plug-in log does not contain any trace information, the refresh interval for the plug-in may not have been reached. Wait longer or restart the Web server.

13. Change the Log tag back to its original setting.

Example 5-14 Plug-in trace when using cookies

...
ws_common: websphereWriteRequestReadResponse: Enter
ws_common: websphereHandleSessionAffinity: Checking for session affinity
ws_common: websphereHandleSessionAffinity: Checking the SSL session id
lib_htrequest: htrequestGetCookieValue: Looking for cookie: 'SSLJSESSION'
lib_htrequest: htrequestGetCookieValue: No cookie found for: 'SSLJSESSION'
ws_common: websphereHandleSessionAffinity: Checking the cookie affinity: JSESSIONID
lib_htrequest: htrequestGetCookieValue: Looking for cookie: 'JSESSIONID'
lib_htrequest: htrequestGetCookieValue: name='JSESSIONID', 
value='0000UHhjdwuWJIed1Ziom5Vb6hM:v544d031'
ws_common: websphereParseCloneID: Parsing clone ids from '0000UHhjdwuWJIed1Ziom5Vb6hM:v544d031'
ws_common: websphereParseCloneID: Adding clone id 'v544d031'
ws_common: websphereParseCloneID: Returning list of clone ids
ws_server_group: serverGroupFindClone: Looking for clone
ws_server_group: serverGroupGetFirstPrimaryServer: getting the first primary server
ws_server_group: serverGroupFindClone: Comparing curCloneID 'v544d031' to server clone id 
'v544d031'
ws_server_group: serverGroupFindClone: Match for clone 'was1node_PluginMember1'
ws_server: serverHasReachedMaxConnections: currentConnectionsCount 0, maxConnectionsCount -1.
ws_server_group: serverGroupCheckServerStatus: Checking status of was1node_PluginMember1, 
ignoreWeights 1, markedDown 0, retryNow 0, wlbAllows 2 reachedMaxConnectionsLimit 0
ws_server: serverHasReachedMaxConnections: currentConnectionsCount 0, maxConnectionsCount -1.
ws_server_group: serverGroupIncrementConnectionCount: Server was1node_PluginMember1 picked, 
pendingConnectionCount 1 totalConnectionsCount 3.
ws_common: websphereHandleSessionAffinity: Setting server to was1node_PluginMember1
ws_server_group: assureWeightsValid: group PluginCluster
ws_server_group: serverGroupGetFirstPrimaryServer: getting the first primary server
ws_server_group: weights_need_reset: was1node_PluginMember1: 4 max, 2 cur.
ws_server_group: lockedServerGroupUseServer: Server was1node_PluginMember1 picked, weight 1.
ws_common: websphereFindTransport: Finding the transport
ws_common: websphereFindTransport: Setting the transport(case 2): app1.itso.ibm.com on port 
9088
ws_common: websphereExecute: Executing the transaction with the app server
ws_common: websphereGetStream: Getting the stream to the app server
ws_transport: transportStreamDequeue: Checking for existing stream from the queue
ws_common: websphereSocketIsClosed: Checking to see if socket is still open
ws_common: websphereGetStream: Using existing stream from transport queue
...

 

SSL ID

We tested session affinity using SSL ID and cookies as follows:

1. Set up your Web server for SSL traffic. See the relevant Web server documentation for details on this.

2. In the Administrative Console, go to the virtual host definitions by clicking Environment -> Virtual Hosts -> PluginVirtualHost -> Host Aliases -> New.

3. Add the host name as web1 and the port as 443 and click Apply.

4. Go to Servers -> ApplicationServers -> <AppServer Name> -> Web Container -> Session Management. Select Enable SSL ID tracking and Enable Cookies. We did this at the appserver level so that all other session management levels would be overwritten. However, if you have overwrite session management set at the application or Web module level this will not work.

5. Click Apply and synchronize the changes.

6. Repeat steps 4 and 5 for PluginMember2.

7. Stop and start your cluster to make the session manager changes operational.

8. Regenerate the plug-in configuration file for your Web servers.

9. In the plugin-cfg.xml file, change the Log tag. Set the Log tag so that the line looks similar to:

<Log LogLevel="Trace" Name="/usr/WebSphere/AppServer/logs/sesstrace.log"/>

10. Save and close the plugin-cfg.xml file.

11. Open a browser and go to:

https://<yourWebServer>/hitcount

Make sure to connect using https from your Web server.

12. From the Select a method of execution option, select Session state (see Figure 5-18).

13. Click the Increment button a few times.

14. Open your plug-in log as specified in step 9. Look through the processing of the requests and search for websphereHandleSessionAffinity.

You should see something similar to that shown in Example 5-15.

15. Change the Log tag back to its original setting.

Note: When using SSL between the client and the Web server, WAS V5.1 will try to use SSL communication between the plug-in and the Web container. To disable this, just delete the HTTPS transport lines for the server in plugin-cfg.xml. Otherwise, refer to the redbook IBM WebSphere V5.0 Security, SG24-6573 on details of how to set up HTTPS communication between the plug-in and Web container.

Example 5-15 Plug-in trace when using SSL ID and cookies

...
ws_common: websphereWriteRequestReadResponse: Enter
ws_common: websphereHandleSessionAffinity: Checking for session affinity
ws_common: websphereHandleSessionAffinity: Checking the SSL session id
lib_htrequest: htrequestGetCookieValue: Looking for cookie: 'SSLJSESSION'
lib_htrequest: htrequestGetCookieValue: name='SSLJSESSION', 
value='0001SESSIONMANAGEMENTAFFINI:v544d031'
ws_common: websphereParseCloneID: Parsing clone ids from '0001SESSIONMANAGEMENTAFFINI:v544d031'
ws_common: websphereParseCloneID: Adding clone id 'v544d031'
ws_common: websphereParseCloneID: Returning list of clone ids
ws_server_group: serverGroupFindClone: Looking for clone
ws_server_group: serverGroupGetFirstPrimaryServer: getting the first primary server
ws_server_group: serverGroupFindClone: Comparing curCloneID 'v544d031' to server clone id 
'v544d031'
ws_server_group: serverGroupFindClone: Match for clone 'was1node_PluginMember1'
ws_server: serverHasReachedMaxConnections: currentConnectionsCount 0, maxConnectionsCount -1.
ws_server_group: serverGroupCheckServerStatus: Checking status of was1node_PluginMember1, 
ignoreWeights 1, markedDown 0, retryNow 0, wlbAllows 3 reachedMaxConnectionsLimit 0
ws_server: serverHasReachedMaxConnections: currentConnectionsCount 0, maxConnectionsCount -1.
ws_server_group: serverGroupIncrementConnectionCount: Server was1node_PluginMember1 picked, 
pendingConnectionCount 1 totalConnectionsCount 2.
ws_common: websphereHandleSessionAffinity: Setting server to was1node_PluginMember1
ws_server_group: assureWeightsValid: group PluginCluster
ws_server_group: serverGroupGetFirstPrimaryServer: getting the first primary server
ws_server_group: weights_need_reset: was1node_PluginMember1: 4 max, 3 cur.
ws_server_group: lockedServerGroupUseServer: Server was1node_PluginMember1 picked, weight 2.
ws_common: websphereFindTransport: Finding the transport
ws_common: websphereFindTransport: Setting the transport(case 1): app1.itso.ibm.com on port 
9447
ws_common: websphereExecute: Executing the transaction with the app server
ws_common: websphereGetStream: Getting the stream to the app server
ws_transport: transportStreamDequeue: Checking for existing stream from the queue
ws_common: websphereSocketIsClosed: Checking to see if socket is still open
ws_common: websphereGetStream: Using existing stream from transport queue
...

 

URL rewriting

There is no servlet provided with the WebSphere samples that uses URL rewriting. To perform this test, you can either use your own example or the sample given in Appendix B, Sample URL rewrite servlet.

We tested session affinity using the URL rewrite sample given in Appendix B, Sample URL rewrite servlet as follows:

1. Set up the URL rewrite sample application. Make sure you regenerate the plug-in configuration on your Web server.

2. In the plugin-cfg.xml file, change the Log tag. Set the Log tag so that the line looks similar to:

<Log LogLevel="Trace" Name="C:\WebSphere\AppServer\logs\sesstrace.log"/>

3. Save and close the plugin-cfg.xml file.

4. In the Administrative Console, select Servers -> Application Servers.

5. Click <AppServer Name>. In this example, PluginMember1 is selected.

6. Click Web Container -> Session Management. The window shown in Figure 5-19 will appear.

7. Click the Enable URL Rewriting check box.

Figure 5-19 Setting URL rewriting for session management.

8. Synchronize the nodes and then repeat step 4 to 7 for the rest of the cluster members. In our case PluginMember2 has to be updated also.

9. Stop and start your cluster to make the session manager changes operational.

10. Open a browser and go to:

http://<yourWebServer>/urltest/urltest

11. Click the Request this servlet again using the rewritten URL link, as shown in Figure 5-20.

12. Click the Request this servlet again using the rewritten URL link a few more times.

Figure 5-20 URL rewriting example

13. Open your plug-in log as specified in step 2. Look through the processing of the requests and search for websphereHandleSessionAffinity.

You should see something similar to that shown in Example 5-16.

14. Change the Log tag back to its original setting.

Example 5-16 Plug-in trace when using URL rewriting

...
ws_common: websphereWriteRequestReadResponse: Enter
ws_common: websphereHandleSessionAffinity: Checking for session affinity
ws_common: websphereHandleSessionAffinity: Checking the SSL session id
lib_htrequest: htrequestGetCookieValue: Looking for cookie: 'SSLJSESSION'
lib_htrequest: htrequestGetCookieValue: No cookie found for: 'SSLJSESSION'
ws_common: websphereHandleSessionAffinity: Checking the cookie affinity: JSESSIONID
lib_htrequest: htrequestGetCookieValue: Looking for cookie: 'JSESSIONID'
lib_htrequest: htrequestGetCookieValue: No cookie found for: 'JSESSIONID'
ws_common: websphereHandleSessionAffinity: Checking the url rewrite affinity: jsessionid
ws_common: websphereParseSessionID: Parsing session id from 
'/urltest/urltest;jsessionid=0000QfIYa4K5afzDVPXIRH8UUns:v544d0o0'
ws_common: websphereParseSessionID: Parsed session id 
'jsessionid=0000QfIYa4K5afzDVPXIRH8UUns:v544d0o0'
ws_common: websphereParseCloneID: Parsing clone ids from 
'/urltest/urltest;jsessionid=0000QfIYa4K5afzDVPXIRH8UUns:v544d0o0'
ws_common: websphereParseCloneID: Adding clone id 'v544d0o0'
ws_common: websphereParseCloneID: Returning list of clone ids
ws_server_group: serverGroupFindClone: Looking for clone
ws_server_group: serverGroupGetFirstPrimaryServer: getting the first primary server
ws_server_group: serverGroupFindClone: Comparing curCloneID 'v544d0o0' to server clone id 
'v544d031'
ws_server_group: serverGroupGetNextPrimaryServer: getting the next primary server
ws_server_group: serverGroupFindClone: Comparing curCloneID 'v544d0o0' to server clone id 
'v544d0o0'
ws_server_group: serverGroupFindClone: Match for clone 'was2Node_PluginMember2'
ws_server: serverHasReachedMaxConnections: currentConnectionsCount 0, maxConnectionsCount -1.
ws_server_group: serverGroupCheckServerStatus: Checking status of was2Node_PluginMember2, 
ignoreWeights 1, markedDown 0, retryNow 0, wlbAllows 0 reachedMaxConnectionsLimit 0
ws_server: serverHasReachedMaxConnections: currentConnectionsCount 0, maxConnectionsCount -1.
ws_server_group: serverGroupIncrementConnectionCount: Server was2Node_PluginMember2 picked, 
pendingConnectionCount 1 totalConnectionsCount 2.
ws_common: websphereHandleSessionAffinity: Setting server to was2Node_PluginMember2
ws_server_group: assureWeightsValid: group PluginCluster
ws_server_group: serverGroupGetFirstPrimaryServer: getting the first primary server
ws_server_group: weights_need_reset: was1node_PluginMember1: 4 max, 4 cur.
ws_server_group: lockedServerGroupUseServer: Server was2Node_PluginMember2 picked, weight -1.
ws_common: websphereFindTransport: Finding the transport
ws_common: websphereFindTransport: Setting the transport(case 2): app2.itso.ibm.com on port 
9086
ws_common: websphereExecute: Executing the transaction with the app server
ws_common: websphereGetStream: Getting the stream to the app server
ws_transport: transportStreamDequeue: Checking for existing stream from the queue
ws_common: websphereSocketIsClosed: Checking to see if socket is still open
ws_common: websphereGetStream: Using existing stream from transport queue
...

  Prev | Home | Next

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.