Tune session management
WAS session support has features for tuning session performance and operating characteristics, particularly when sessions are configured in a distributed environment. These options support the administrator flexibility in determining the performance and failover characteristics for their environment.
You configure these options in the WebSphere administrative console. The settings are listed by which page in the console that they appear.
Session management
The Session Management page of the console contains these settings that are related to performance tuning:
Overflow and Maximum in-memory session count
These settings specify the maximum number of sessions that are retained in memory, and whether or not to ever exceed that number. For more information, see Maximum in-memory session count.Serialize session access
Specifies that concurrent session access in a given server is not allowed. In a distributed environment, the Session Manager requires an affinity mechanism so that requests for a particular session are always sent to the same application server each time. This satisfies the Servlet 2.3 requirement that a session can only be active in one Java virtual machine at a time. It also provides for better performance, because the sessions are cached in memory.
Database Settings
In the Session Management page, click Distributed Environment Settings, and then click Database. The Database Setting page contains the Multi row schema setting, which can be used to tune performance for database-persisted sessions. For more information, see Multi row schema.
Tuning parameters
In the Session Management page of the administrative console, click Distributed Environment Settings, and then click Custom Tuning Parameters. The Tuning Parameters page contains these tuning levels:
- Very high
- High
- Medium
- Low
- Custom settings
The tuning levels are comprised of settings that pertain to these concepts:
Write frequency
Minimize database write operations. This option is only available for database persistence and memory-to-memory replication. For more information, see Write frequency.Write contents
Allow flexibility in determining what session data to write. This option is only available for database persistence and memory-to-memory replication. For more information, see Write contents.Schedule sessions cleanup
Minimize contention between session requests and invalidation of sessions by the Session Management facility. Minimize write operations to database for updates to last access time only. Database and Memory-to-Memory. For more information, see Schedule sessions cleanup.Schedule invalidation
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. For more information, see Configure scheduled invalidation.
You can select a pre-defined tuning level, or click Custom settings to create your own tuning level based on Write frequency, Write contents, and Schedule sessions cleanup settings.
Tuning recommendations
It is recommended that you follow these guidelines to ensure optimal performance:
- In the Session Manager Service, set the Maximum in-memory session count value to a number close to the average number of active sessions. If there are frequent periods where more sessions are active, increasing the base memory value further might improve performance. Also enable Allow overflow.
- Do not enable persistent sessions unless the application requires them. If persistent sessions are required, enable multi-row sessions.
- If possible, invalidate finished sessions promptly in your application. Use the javax.servlet.http.HttpSession.invalidate() method to invalidate these sessions. Also set the Invalidation Timeout to the smallest value that is acceptable for your application. If you set it too small, sessions timeout prematurely. You might need to do some testing to determine the appropriate value for your application.