Close

Why Session Objects should implement Serializable?

[Last Updated: Feb 8, 2017]

Java Servlet 

To support replication, all Objects stored in the javax.servlet.http.HTTPSession should implement Serializable.

The replication is needed for the failover cluster mode.

Serializing session data introduces some overhead for replicating the session state. The overhead increases as the size of serialized objects grows. If we plan to create very large objects in the session, we should first test the performance of servlets to ensure that performance is acceptable.

See Also