If you are using in-memory replication to store session state data, you must use the asadmin set command to enable web container availability and to set properties.
For example, use the set command as follows, where config1 is the configuration name:
asadmin set config1.availability-service.web-container-availability.availability-enabled="true" |
asadmin set config1.availability-service.web-container-availability.persistence-frequency="time-based" |
In the tree component, select the desired configuration.
Click on Availability Service.
Select the Web Container Availability tab.
Check the Availability Service box to enable availability. To disable it, uncheck the box.
Change other settings, as described in the following section, Web Container Availability Settings
Restart the server instance.
The Web Container Availability tab of the Availability Service enables you to change these availability settings:
Persistence Type: Specifies the session persistence mechanism for web applications that have availability enabled. Allowed values are memory (no persistence) file (the file system), and replicated (memory on other servers).
If web container availability is enabled, the default persistence type depends on the profile, as shown in the following table.
Profile |
Persistence Type |
---|---|
Developer |
memory |
Cluster |
replicated |
For production environments that require session persistence, use replicated. The memory persistence type and the file persistence type do not provide high availability session persistence.
If web container availability is disabled, the default persistence type memory.
Persistence Frequency: Specifies how often the session state is stored. Applicable only if the Persistence Type is replicated. Allowed values are:
web-method - The session state is stored at the end of each web request prior to sending a response back to the client. This mode provides the best guarantee that the session state is fully updated in case of failure. This is the default.
time-based - The session state is stored in the background at the frequency set by the reapIntervalSeconds store property. This mode provides does not guarantee that session state is fully updated. However, it can provide a significant performance improvement because the state is not stored after each request.
Persistence Scope : Specifies how much of the session object and how often session state is stored. Applicable only if the Persistence Type is replicated. Allowed values are as follows:
session - The entire session state is stored every time. This mode provides the best guarantee that your session data is correctly stored for any distributable web application. This is the default.
modified-session - The entire session state is stored if it has been modified. A session is considered to have been modified if HttpSession.setAttribute() or HttpSession.removeAttribute() was called. You must guarantee that setAttribute() is called every time an attribute is changed. This is not a Java EE specification requirement, but it is required for this mode to work properly.
modified-attribute - Only modified session attributes are stored. For this mode to work properly, you must follow a few guidelines:
Call setAttribute() every time the session state is modified.
Make sure there are no cross-references between attributes. The object graph under each distinct attribute key is serialized and stored separately. If there are any object cross references between the objects under each separate key, they are not serialized and deserialized correctly.
Distribute the session state across multiple attributes, or at least between a read-only attribute and a modifiable attribute.
Single Sign-On State: Check this box to enable persistence of the single sign-on state. To disable it, uncheck the box. For more information, see Using Single Sign-on with Session Failover