HttpSession 数据存储在哪里?
HttpSession
是一个建立在 cookies 和 url 重写之上的高级接口,这意味着只有一个会话 ID 存储在客户端,与之相关的数据存储在服务器端。
HttpSession
数据实际存储在服务器端的哪里?在 JVM 内存中还是其他地方?我可以更改存储它的位置,例如将它们保存到内存数据库中吗?
如果不在数据库中,当许多客户端同时处理相同的会话数据时,是否会出现并发问题?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(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.