Configure distributed sessions for session recovery support
WAS provides these session recovery mechanisms in a distributed environment:
- Database session persistence, where sessions are stored in the database specified.
- (Network Deployment only) Memory-to-memory session replication, where sessions are stored in one or more specified WAS instances.
When a session contains attributes that implement HttpSessionActivationListener, notification occurs anytime the session is activated (that is, session is read to the memory cache) or passivated (that is, session leaves the memory cache). Passivation can occur because of a server shutdown or when the session memory cache is full and an older session is removed from the memory cache to make room for a newer session. It is not guaranteed that a session is passivated in one application server prior to being activated in another.
If you want to use database persistence for session data, configure a JDBC provider, and configure a new data source. You may be able to use an existing JDBC provider if one has already been configured to use the desired JDBC driver. Regardless, still create a new data source for the session manager service to use when persisting servlet session data. For example, you could create a new data source named SessionDataSource that uses a JDBC provider named LocalJDBCDriver.
Note: By default, the servlet session data is stored in a collection named QEJBAS5SN. This default collection is used if no collection name is specified as a Custom Property of the data source used for HTTP session persistence. It is not recommended that you use this default collection, especially in cases where you are running multiple instances of WebSphere on your server, because those instances will be using the same default collection. When you specify a collection on the iSeries server, the collection name is limited to ten characters. How to specify a collection name depends on which JDBC Provider you use. For example, to specify a collection (library) named MYSESSN under Data Sources -> datasource_name -> Custom Properties in the topology tree, make the following changes:
- Change the value of the databaseName property from *LOCAL to *LOCAL/MYSESSN for DB2 UDB for iSeries (Native - V5R2 and later) or DB2 UDB for iSeries (Native - V5R1 and earlier).
- Specify the value of the libraries property to MYSESSN for DB2 UDB for iSeries (Toolbox).
To configure distributed sessions in the WebSphere administrative console, perform these steps:
In the topology tree, expand Servers, expand Application Servers, and click your application server.
Click Web Container.
Under Additional Properties, click Session Management.
In the Session Management page of the console that is appropriate to the level you are configuring, click Distributed Environment Settings.
Under General Properties for the Distributed Sessions property, select the way in which you want sessions saved:
Database
This option specifies to save session in a database. If you have only the base product, select Database for session recovery purposes.Click Database to define additional properties:
Datasource JNDI name
(Required) Specifies the JNDI name of data source from which the Session Manager service obtains database connections. The data source represents a pool of database connections and a configuration for that pool.User ID
(Optional) The user name for connecting to the database when no user ID and password pair is specified for the data source. If you specify the user property, specify the password property.Password
(Optional) The password for connecting to the database when no user ID and password pair is specified for the data source. If you specify the user property, specify the password property.Note: When using the DB2 Universal Database for iSeries (IBM Toolbox for Java) JDBC driver, User ID and Password are required.
DB2 row size
(Not applicable) This property is not used by WAS for iSeries. It can be left blank.Table space name
(Not applicable) This property is not used by WAS for iSeries. It can be left blank.Use Multi row schema
(Optional) Specifies whether to place each instance of application data in a separate row in the database, which allows for larger amounts of data to be stored for each session. This can yield better performance in certain usage scenarios. If using multi-row sessions is not enabled, instances of application data can be placed in the same row. For more information, see Multi-row schema.
Memory to Memory Replication
This option distributes session storage across multiple instances. This setting is only available in the Network Deployment product.To define additional properties, click Memory to Memory Replication, and then click the name of the replicator instance that you want to use. See the console help documentation for Internal replication domain settings
for information about these properties.
Click OK or Apply to update the configuration.
Click Save to save your configuration.