Instead of relying on the periodic invalidation timer that
runs on an interval based on the session timeout parameter, you can
set specific times for the session management facility to scan for
invalidated sessions in a distributed environment.
When used with distributed sessions, this feature has the following
benefits:
- You can schedule the scan for invalidated sessions for times of
low application server activity, avoiding contention between invalidation
scans of database or another WebSphere® Application Server
instance and read and write operations to service HTTP session requests.
- Significantly fewer external write operations can occur when running
with the End of Service Method Write mode because the last access
time of the session does not need to be written out on each HTTP request.
(Manual Update options and Time Based Write options already minimize
the writing of the last access time.)
- The session manager invalidates sessions only at the scheduled
time, therefore sessions are available to an application if they are
requested prior to the session is invalidated. The following are usage
considerations:
- With scheduled invalidation configured, HttpSession timeouts are
not strictly enforced. Instead, all invalidation processing is handled
at the configured invalidation times.
- HttpSessionBindingListener processing is handled at the configured
invalidation times unless the HttpSession.invalidate method is explicitly
called.
- The HttpSession.invalidate method immediately invalidates the
session from both the session cache and the external store.
- The periodic invalidation thread still runs with scheduled invalidation.
If the current hour of the day does not match one of the configured
hours, sessions that have exceeded the invalidation interval are removed
from cache, but not from the external store. Another request for
that session results in returning that session back into the cache.
- When the periodic invalidation thread runs during one of the configured
hours, all sessions that have exceeded the invalidation interval
are invalidated by removal from both the cache and the external store.
- The periodic invalidation thread can run more than once during
an hour and does not necessarily run exactly at the top of the hour.
- If you specify the interval for the periodic invalidation thread
using the HttpSessionReaperPollInterval custom property, do not
specify a value of more than 3600 seconds (1 hour) to ensure that
invalidation processing happens at least once during each hour.