You can use the following guidelines for optimizing HTTP session usage within your application. Here are a few points to consider:
Use in-memory replication techniques for session replication if possible. This approach is 10 times faster than the JDBC-based session persistence.
When you're using session replication in a WebLogic cluster, minimize the session.setAttribute() operations. Each update to the session with a setAttribute operation will cause the following updates to occur:
An update being made to the session state on the secondary server via a remote call, in case of in-memory replication.
An update being made to the session state maintained in the database with a database write, in case of JDBC-based session persistence.
An update being made to the session state maintained in the file with an I/O write, in case of file-based session persistence.
To minimize the session put operations, increase the granularity of the session update; for example, aggregate different put operations into one single put operation, if possible. Update the session with larger aggregate objects rather than multiple smaller objects.
Factor for the session size and the average number of active sessions while tuning the WebLogic Server heap.
Use sessions only when state cannot be maintained on the client side ”for example, in cookies.