SQL Server会话状态持久性如何工作? [英] How does SQL Server session state persistence work?

查看:80
本文介绍了SQL Server会话状态持久性如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不喜欢使用ASP.NET会话状态,但是我们的应用程序目前正在使用它.我们正在使用SQL Server模式进行会话状态持久化.我正在考虑在会话状态下缓存授权检查结果,但是我担心这种方法的性能..NET中SQL Server会话状态持久性到底如何工作?

据我所知,所有会话数据都存储在一个数据库行中,而数据本身存储在一列中.我担心的是,如果我们的应用程序在一个请求中执行12个不同的授权检查,并且每个结果在收到后立即存储,那么在存储这些项目时将发出12个不同的数据库请求,这将使我减少的任何网络请求减少试图完成.

每个会话状态突变是否伴随同步数据库请求,还是在ASP.NET请求生命周期中一次保留所有会话状态更改?

解决方案

在应用程序事件 ReleaseRequestState 之后,会话在每个ASP.NET请求的末尾保留-而不是在会话数据更改时保留./p>

I'm not a fan of using ASP.NET session state, but our application is using it at this time. We are using SQL Server mode for session state persistence. I'm considering caching authorization check results in the session state, but I worry about the performance of this approach. How exactly does SQL Server session state persistence work in .NET?

From what I can tell, all session data is stored in one database row, with the data itself stored in one column. My worry is that if our application does 12 different authorization checks in one request, and each result is stored immediately after received, that 12 different database requests would be made as those items are stored, which would nullify any network request reductions that I'm trying to accomplish.

Is each session state mutation accompanied by a synchronous database request, or are all session state changes persisted at one time during the ASP.NET request life cycle?

解决方案

Sessions are persisted at the end of each ASP.NET request after the ReleaseRequestState application event - and not on session data change.

这篇关于SQL Server会话状态持久性如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆