(1) 在服务器负荷不是很大的情况下session能够正常复制,但是用户大并发量访问时,服务器在超负荷的情况下,集群中各服务器之间session存在无法正常复制的情况,在这种情况下一旦发生服务器切换,由于session没有正常复制,用户还是会退出系统。
(2) 当往session中存放的数据比较大时,系统的响应速度明显变慢,有时会出现内存溢出的情况。
(3) 如果往session中存放对象时,在修改对象属性状态之后必须调用session的setAttribute方法重新将该对象放入session,才能将最新的对象状态同步到备用服务器上去。这一点在编程中很难保证,尤其是在已经存在的系统中。
(4)在特定的框架集(frameset)中,确保只有一个框架(frame)创建和修改会话数据;必须确保只在第一个框架集的一个框架中创建会话,其他框架集访问该session。原因如下:
If you are designing a Web application that utilizes multiple frames, keep in mind that there is no synchronization of requests made by frames in a given frameset. For example, it is possible for multiple frames in a frameset to create multiple sessions on behalf of the client application, even though the client should logically create only a single session.
In a clustered environment, poor coordination of frame requests can cause unexpected application behavior. For example, multiple frame requests can “reset” the application’s association with a clustered instance, because the proxy plug-in treats each request independently. It is also possible for an application to corrupt session data by modifying the same session attribute via multiple frames in a frameset.
(5)最后保存在session中的对象一定要序列话,即实现java.io.Serializable接口。