Where is the HttpSession data stored?

最后都变了- 提交于 2019-12-01 04:27:50

问题


HttpSession is a high level interface built on top of cookies and url-rewriting, which means that there is only a session ID is stored in client side and the data associated with it is stored in server side.

Where is the HttpSession data actually stored in the server side? In the JVM memory or somewhere else? Can I change the place where to store it, e.g. save them into an in-memory database?

If it's not in a database, is there any concurrency problem when many clients work on the same session data at the same time?


回答1:


It's up to the server where to store session data; the ones I'm familiar with allow some level of configuration as to where (disk, DB, memory, ...) session data is stored.

Different clients shouldn't be working on the same session data--session data is per-client. That said, a single client (like a web browser) could have multiple windows or tabs open, and yes, that can cause issues.

Clustering adds a layer of complexity/headache as session data is shared between servers.



来源:https://stackoverflow.com/questions/7885525/where-is-the-httpsession-data-stored

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!