Sql SessionState 服务器和超时
您好,使用 Sql Server 作为 SessionState 服务器并将超时增加到 2 周有什么缺点吗?我的目标是让人们尽可能长时间地登录,同时将网络服务器内存保持在最低限度。
Hi is there a downside to using Sql Server as a SessionState server and increasing the timeout to 2 weeks? My goal is to keep people logged in as long as possible while keeping webserver memory at a minimum.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您在会话中存储了哪些信息?它们会消耗服务器资源,一般情况下不会让它们存活 2 周。
您可以存储 cookie 以将用户标记为已登录,并在用户再次回来时加载会话数据。
What are the information you store in the session? They consume server resource and its not a general practice to keep them alive for 2 weeks.
You can store a cookie to mark the user as logged in and load the session data when he comes back again.
我想你可能对这里的一些概念有点困惑。
SessionState 和“已登录”可能意味着两种不同的事物。
SessionState 表示环境中存储在“Session”对象中的对象/数据。用户登录通常使用 ASP.NET 会员系统进行控制。您可以让一个用户进行持久登录(记住我),但会话将在 20 分钟后超时。系统仍会记住它们,但在会话中为用户“缓存”的数据可能会消失。
更直接地回答你的问题,是的,这种类型的 SQL 会话状态方法存在许多问题,并且根据放入会话的值的大小和流量,它可能或多或少是极端的。
这些信息仍然会占用内存,只是数据库端的硬盘内存,但随着它的增长,您可以看到性能下降。仅会话放弃就可能导致缓存大量数据。
随着会话项数量的增加,会话的性能会下降,SQL Server系统的负载也会变大。
根据服务器的大小、SQL Server 许可证以及流量,您可能会遇到数据库或硬件限制存储会话那么长时间的问题。
I think you might have a few concepts confused here a bit.
SessionState and "Logged In" can mean two different things.
SessionState represents objects/data stored in the "Session" object within the environment. The users login is typically controlled using the ASP.NET Membership system. You can have a user that has a persistent login (Remember Me) but the session will time out after 20 minutes. The system will still remember them, but data that was "cached" for the user in session might be gone.
More directly to your question, yes, there are NUMEROUS issues with this type of approach for SQL Session State, and depending on the size of the values put to session and the traffic it could be more or less extreme.
This information is still going to take memory, just hard-disk memory on the DB side, but as it grows you can see performance reductions. Session abandonment alone could cause massive amounts of data cached.
As the number of session items grows, the performance of session will degrade, and the load on the SQL Server system will be more.
Depending on the size of the server, and the SQL Server license, and the traffic you could have issues with DB or hardware limitations storing session for that long.