Chapter 5. Tuning WebSphere Application Server 105
5.5 Effect of enabling WAS session management
WebSphere Commerce Suite supports two types of session management;
cookie-based and URL rewriting. The administrator can choose to support either
only cookie-based session management or both cookie-based and URL rewriting
session management. If Commerce Suite only supports cookie-based
management, shoppers' browsers must be able to accept cookies. If both
cookie-based and URL rewriting are selected, Commerce Suite first attempts to
use cookies to manage sessions. If the shopper's browser is set to not accept
cookies, URL rewriting is used.
Commerce Suite session cookies are internal to Commerce Suite and are not
persisted to the database, whereas WebSphere Application Server cookies
provide an option to persist either to memory or to the database. There are two
cases when WAS session management turns out to be more useful than WCS
session management. First, if you plan to install multiple WCS machines and
want to let them share session information, use WebSphere Application Servers
session management to persist the session information to WebSphere
Application Servers database. Second, if users wish to store and maintain their
own session information, it may not be appropriate to use WCS sessions,
especially if the users session information is large. Under these conditions, the
users may decide to use WAS Session Management.
To turn on WAS session management, go to WebSphere Commerce Suite
Configuration Manager. Develop the tree by first selecting WebSphere
Commerce Suite -> node name -> Instance List -> instance name ->
Instance properties -> Session Management.
106 WCS V5.1 Performance Tuning
Figure 5-16 Switching from WCS to WAS session management
As you can see in Figure 5-16, the Cookie session manager parameter in the
General tab has a drop down list that allows you to select the management
system required by your application.
Note that WebSphere Commerce Suite session manager automatically enables
session persistence in case of multi-tier installation. You do not have to do it
yourself. If you are using WAS session management, however, you will have to
take care of the persistence issue. To enable WAS session management, simply
switch the value of Cookie session manager from WCS to WAS .
WebSphere Application Server manages sessions in two different ways. You can
either set it to keep session information in its memory, or to save it in a database.
The second option is accomplished by enabling persistent session management.
Chapter 5. Tuning WebSphere Application Server 107
The benefits of using persistent sessions are:
򐂰 To keep session information from disappearing in case of a failure of the
application server node.
򐂰 To share this information between different application server instances.
򐂰 To reduce the quantity of information loaded in memory when you store very
large objects in your sessions.
You need to enable persistent session management in case that you want to
establish workload management among multiple WCS clones. You can get more
information on the procedure required to create clones in Chapter 4 of
WebSphere Scalability: WLM and Clustering using WebSphere Application
Server, SG24-6153.
To activate persistent session management in WAS, you first need to create a
database that will hold all the session information. Log on as your db2
administrator ID, then enter the following command on your database server:
db2 create db <name_of_db>
where you will replace <name_of_db> with the name you want to give to this
database. For our tests, we simply called it session. If the database is on a
remote machine, you need to create a database alias on the WAS machine.
Create a new DataSource in WebSphere, referencing the new table. To do that,
right-click on WebSphere Administrative Domain, and then select Create ->
DataSource. Give a name to the DataSource. We called our new DataSource
WCS Sessions DB2 Datasource session. In case that the database is on a
remote machine, you need to provide database user id and its password. Enter
the name of your database, which was named as session in our case. Next
select the correct driver for your database.
Once your DataSource is created, you can activate the persistence sessions in
WebSphere Application Server. Expand WebSphere Administrative Domain ->
node name -> WebSphere Commerce Server -> WCS Web Container ->
Session Manager.
Select the Enable tab, as shown on Figure 5-17 on page 108, and then set
Enable Persistent Sessions to Yes.
108 WCS V5.1 Performance Tuning
Figure 5-17 Enabling persistent session management
Next switch to the Persistence tab and enter the DataSource name you have
defined, as shown in Figure 5-18 on page 109.

Get WCS V5.1 Performance Tuning now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.