Administration guide > Configure the deployment environment > Configuring cache integration > Configuring HTTP session managers
XML files for HTTP session manager configuration
Sample files location
Sample WXS stand-alone XML files can be found in...
$WXS_HOME/ObjectGrid/session/samplesFor WXS installed in a WAS cell, sample XML files can be found in....
was_root/optionalLibraries/ObjectGrid/session/samplesIf you are configuring an embedded scenario, which means that the container server starts in the web container tier, the XML files are provided by default....
- objectGrid.xml
- objectGridDeployment.xml
You can update these files to customize the behavior of the HTTP session manager.
objectGrid.xml file
<?xml version="1.0" encoding="UTF-8"?> <objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ibm.com/ws/objectgrid/configobjectGrid.xsd" xmlns="http://ibm.com/ws/objectgrid/config"> <objectGrids> <objectGrid name="session"> <bean id="ObjectGridEventListener" className="com.ibm.ws.xs.sessionmanager.SessionHandleManager"/> <backingMap name="objectgridSessionMetadata" pluginCollectionRef="objectgridSessionMetadata" readOnly="false" lockStrategy="PESSIMISTIC" ttlEvictorType="LAST_ACCESS_TIME" timeToLive="3600" copyMode="NO_COPY"/> <backingMap name="objectgridSessionAttribute.*" template="true" readOnly="false" lockStrategy="PESSIMISTIC" ttlEvictorType="NONE" copyMode="NO_COPY"/> <backingMap name="objectgridSessionTTL.*" template="true" readOnly="false" lockStrategy="PESSIMISTIC" ttlEvictorType="LAST_ACCESS_TIME" timeToLive="3600" copyMode="NO_COPY"/> </objectGrid> </objectGrids> <backingMapPluginCollections> <backingMapPluginCollection id="objectgridSessionMetadata"> <bean id="MapEventListener" className="com.ibm.ws.xs.sessionmanager.MetadataMapListener"/> </backingMapPluginCollection> </backingMapPluginCollections> </objectGridConfig>
Values you can change:
- ObjectGrid name attribute:
The value must match the following values in other configuration files:
- The objectGridName property in the splicer.properties file that is used to splice the web application.
- The objectgridName attribute in the objectGridDeployment.xml file.
For example...
$ grep DYNACACHE_REMOTE *.xml
dynacache-remote-deployment.xml: <objectgridDeployment objectgridName="DYNACACHE_REMOTE">
dynacache-remote-deployment.xml: <mapSet name="DYNACACHE_REMOTE"
dynacache-remote-objectgrid.xml: < name="DYNACACHE_REMOTE" txTimeout="30">If you have multiple applications, and you want the session data to be stored in different grids, those applications should have different ObjectGrid name attribute values. The name of the ObjectGrid is the only thing that can be changed in this file.
Values that you cannot change:
- ObjectGridEventListener:
The ObjectGridEventListener line cannot be changed and is used internally.
- objectgridSessionMetadata:
The objectgridSessionMetadata line refers to the map where the HTTP session metadata is stored. There is one entry for every HTTP session stored in the grid in this map.
- objectgridSessionTTL*:
This value cannot be changed and is for future use.
- objectgridSessionAttribute.*
The objectgridSessionAttribute.* line defines a dynamic map that is used to create the map in which HTTP session attributes are stored when the fragmentedSession parameter is set to true in the splicer.properties file that is used to splice the web application. This dynamic map is called objectgridSessionAttribute. Another map is created based on this template called objectgridSessionAttributeEvicted, which stores sessions that have timed out, but the web container has not invalidated.
- The MapEventListener line is internal and cannot be modified
objectGridDeployment.xml file
<?xml version="1.0" encoding="UTF-8"?> <deploymentPolicy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ibm.com/ws/objectgrid/deploymentPolicydeploymentPolicy.xsd" xmlns="http://ibm.com/ws/objectgrid/deploymentPolicy"> <objectgridDeployment objectgridName="session"> <mapSet name="sessionMapSet" numberOfPartitions="5" minSyncReplicas="0" maxSyncReplicas="0" maxAsyncReplicas="1" developmentMode="false" placementStrategy="PER_CONTAINER"> <map ref="objectgridSessionMetadata"/> <map ref="objectgridSessionAttribute.*"/> <map ref="objectgridSessionTTL.*"/> </mapSet> </objectgridDeployment> </deploymentPolicy>
Values you can change:
- objectgridName attribute:
The value must match the following values in other configuration files:
- The objectGridName property in the splicer.properties file that is used to splice the web application.
- The ObjectGrid name attribute in the objectGrid.xml file.
If you have multiple applications, and you want the session data to be stored in different grids, those applications should have different ObjectGrid name attribute values.
mapSet element attributes
You can change all mapSet properties except for the placementStrategy attribute.
Name Can be updated to any value. numberOfPartitions Number of primary partitions that are started in each server that is hosting the web application. As you add partitions, the data becomes more spread out in the event of a failover. The default value is 5 partitions, and is fine for most applications. minSyncReplicas, maxSyncReplicas, and maxAsyncReplicas Number and type of replicas that store the HTTP session data. The default is 1 asynchronous replica, which is fine for most applications. Synchronous replication occurs during the request path, which can increase the response times for the web application. developmentMode Informs the WXS placement service whether the replica shards for a partition can be placed on the same node as its primary shard. You can set the value to true in a development environment, but disable this function in a production environment because a node failure could cause the loss of session data. placementStrategy Do not change the value of this attribute.
- The rest of the file refers to the same map names as in the objectGrid.xml. These names cannot be changed.
Values you cannot change:
- The placementStrategy attribute on the mapSet element.
Remote XML package
When you are using the remote mode, where the containers run as standalone processes, use the objectGridStandAlone.xml and objectGridDeploymentStandAlone.xml files to start the processes. You can update these files to modify the configuration.
objectGridStandAlone.xml file
<?xml version="1.0" encoding="UTF-8"?> <objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ibm.com/ws/objectgrid/config/objectGrid.xsd" xmlns="http://ibm.com/ws/objectgrid/config"> <objectGrids> <objectGrid name="session"> <bean id="ObjectGridEventListener" className="com.ibm.ws.xs.sessionmanager.SessionHandleManager"/> <backingMap name="objectgridSessionMetadata" pluginCollectionRef="objectgridSessionMetadata" readOnly="false" lockStrategy="PESSIMISTIC" ttlEvictorType="LAST_ACCESS_TIME" timeToLive="3600" copyMode="COPY_TO_BYTES"/> <backingMap name="#objectgridSessionAttribute">objectgridSessionAttribute.*" template="true" readOnly="false" lockStrategy="PESSIMISTIC" ttlEvictorType="NONE" copyMode="COPY_TO_BYTES"/> <backingMap name="objectgridSessionTTL.*" template="true" readOnly="false" lockStrategy="PESSIMISTIC" ttlEvictorType="LAST_ACCESS_TIME" timeToLive="3600" copyMode="COPY_TO_BYTES"/> </objectGrid> </objectGrids> <backingMapPluginCollections> <backingMapPluginCollection id="objectgridSessionMetadata"> <bean id="MapEventListener" className="com.ibm.ws.xs.sessionmanager.MetadataMapListener"/> </backingMapPluginCollection> </backingMapPluginCollections> </objectGridConfig>
Values you can change:
- objectgridName attribute:
The value must match the following values in other configuration files:
- The objectGridName property in the splicer.properties file that is used to splice the web application.
- The ObjectGrid name attribute in the objectGridStandAlone.xml file.
If you have multiple applications, and you want the session data to be stored in different grids, those applications should have different ObjectGrid name attribute values. The name of the ObjectGrid is the only thing that can be changed in this file.
Values you cannot change:
- ObjectGridEventListener:
The ObjectGridEventListener line cannot be changed and is used internally.
- objectgridSessionMetadata:
Refers to the map where the HTTP session metadata is stored. There is one entry for every HTTP session stored in the grid in this map.
- objectgridSessionTTL*:
This value cannot be changed and is for future use.
- objectgridSessionAttribute.*
The objectgridSessionAttribute. line defines a dynamic map that is used to create the map in which HTTP session attributes are stored when the fragmentedSession parameter is set to true in the splicer.properties file that is used to splice the web application. This dynamic map is called objectgridSessionAttribute. Another map is created based on this template called objectgridSessionAttributeEvicted, which stores sessions that have timed out, but the web container has not invalidated.
- The MetadataMapListener line is internal and cannot be modified
objectGridDeploymentStandAlone.xml file
<?xml version="1.0" encoding="UTF-8"?> <deploymentPolicy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ibm.com/ws/objectgrid/deploymentPolicy ../deploymentPolicy.xsd" xmlns="http://ibm.com/ws/objectgrid/deploymentPolicy"> <objectgridDeployment objectgridName="session"> <mapSet name="sessionMapSet" numberOfPartitions="5" minSyncReplicas="0" maxSyncReplicas="0" maxAsyncReplicas="1" developmentMode="false" placementStrategy="PER_CONTAINER"> <map ref="objectgridSessionMetadata"/> <map ref="objectgridSessionAttribute.*"/> <map ref="objectgridSessionTTL.*"/> </mapSet> </objectgridDeployment> </deploymentPolicy>
Values you can change:
- objectgridName attribute:
The value must match the following values in other configuration files:
- The objectGridName property in the splicer.properties file that is used to splice the web application.
- The ObjectGrid name attribute in the objectGrid.xml file.
If you have multiple applications, and you want the session data to be stored in different grids, those applications should have different ObjectGrid name attribute values.
mapSet element attributes
You can change all mapSet properties except for the placementStrategy attribute.
Name Can be updated to any value. numberOfPartitions Number of primary partitions that are started in each server that is hosting the web application. As you add partitions, the data becomes more spread out in the event of a failover. The default value is 5 partitions, and is fine for most applications. minSyncReplicas, maxSyncReplicas, and maxAsyncReplicas Number and type of replicas that store the HTTP session data. The default is 1 asynchronous replica, which is fine for most applications. Synchronous replication occurs during the request path, which can increase the response times for the web application. developmentMode Informs the WXS placement service whether the replica shards for a partition can be placed on the same node as its primary shard. You can set the value to true in a development environment, but disable this function in a production environment because a node failure could cause the loss of session data. placementStrategy Do not change the value of this attribute.
- The rest of the file refers to the same map names as in the objectGrid.xml file. These names cannot be changed.
Values you cannot change:
- The placementStrategy attribute on the mapSet element.
Parent topic:
Configure HTTP session managers
Related tasks
Configure the HTTP session manager with WAS
Configure HTTP session manager with WebSphere Portal
Configure the HTTP session manager for various application servers
Related reference
Servlet context initialization parameters