设置 ASPState 数据库事务日志最大大小限制的建议
我们有 ASP.Net MVC 网站,其中有 < 200 个具有长时间运行会话的用户。每个用户在注销之前应保持登录状态至少 6-8 小时。每个用户的平均会话预计小于 1 MB。
我们正在使用 ASPState 数据库进行会话。
我们希望限制事务日志文件的最大大小,目前设置为 8 GB。我们可以少做点吗?如果有的话,有哪些相关的陷阱?
亲切的问候,
We have ASP.Net MVC Website which has < 200 users with long running sessions. Each user is expected to stay logged in for at least 6-8 hrs before logging out. The average session per user is expected to be less than 1 MB.
We are using the ASPState database to for session.
We want to put a restriction on the maximumm size of the transaction log file which is presently set out to 8 GB. Can we do with lesser? What are the associated pitfalls if any?
Kind regards,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您设置的最大文件大小较低,那么您的网站上的所有活动都会面临停止的危险,因为如果日志已满且无法扩展,则无法写入 ASPState。
我对 ASPState 记录活动的方式了解不够(它可能与会话长度、大小或持续时间有很大关系,也可能没有太大关系),无法知道 8 GB 是不够还是太多。听起来您最好将数据库的恢复模型调整为简单(只要事务不是很长,这将防止文件失控增长),或者足够频繁地备份日志以抵消增长/使用在日志备份之间。
推荐阅读:这篇博文、其中的所有链接以及后续对话:
If you set a low maximum file size then you run the danger of all activity on your web site grinding to a halt, because if the log fills up and can't expand, ASPState cannot be written to.
I don't know enough about the way ASPState logs activity (it may or may not have much at all to do with session length, size, or duration) to know if 8 GB is not enough, or way too much. It sounds like you're better off either adjusting the recovery model of the database to simple (which will prevent runaway file growth, as long as transactions aren't really long), or backing up the log frequently enough to offset the growth / usage in between log backups.
Recommended reading: this blog post, all of the links therein, and the followup conversation: