HTTPSession 中存储的属性限制
单个会话中可以存储的数据量是否有最大限制?我知道仅在会话中存储大量数据是很糟糕的。但是,存储的数量是否有限制?如果有,如何通知应用程序已达到此限制?仅此而已有例外吗?
上下文:我指的是 Tomcat 6.0,没有集群,使用 StandardManager(用于会话)。
Is there an maximum amount of data that can be stored in a single session? I know that it is a bad deal to store lots of data just in the session. However, is there a limit to the amount that is stored, if so how is the application notified that this limit has been reached? Is there an exception just for this?
Context: I'm referring to Tomcat 6.0, wihtout being clustered, using the StandardManager (for Sessions).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从来没有听说过 Tomcat 中有这样的限制,在幕后它只是一个映射,所以可能堆就是限制。
但是,如果您的会话如此巨大,您可能会考虑在会话上进行同步,因为修改大型对象可能会增加某些竞争条件的风险(出于性能原因,访问会话在同一用户的不同线程/请求之间不同步 - 您是做出选择,是否可以接受风险)。
Never heard about such a limit in Tomcat, behind the scenes it is just a map, so the heap is the limit, probably.
But if your session is so huge, you might consider synchronization on session, as modifying large objects might increase the risk of some race-conditions (accessing the session is not synchronized between different threads/request from the same user for performance reasons - you are making a choice, whether you can accept the risk or not).
我认为 Tomcat 不会在其默认配置中将任何内容钝化到磁盘,因此您放入会话中的所有内容都会占用内存空间。该限制是运行 Tomcat 的 JVM 的堆大小。
如果在会话中放入太多对象,则有时可能会出现 OutOfMemoryError 错误。
I don't think Tomcat ever passivates anything to disk in its default configuration, so everything you put in session will take space in memory. The limit is the heap size of the JVM running Tomcat.
If you put too many objects in session, you risk getting an OutOfMemoryError at some time.