简体   繁体   English

天蓝色会话和应用程序池回收

[英]azure session and application pool recycle

I changed my session on my dev machine from InProc to SQL Server. 我将开发机器上的会话从InProc更改为SQL Server。 One of the reasons I did this is that in case the application pool would recycle, I'd have the session available again on restart. 我这样做的原因之一是,如果应用程序池可以回收,我将在重新启动时再次使会话可用。 Of course, the downside to a SQL session state is performance (at least compared to InProc). 当然,SQL会话状态的缺点是性能(至少与InProc相比)。

If I move to Azure, do I 1) still need to worry about app pool recycles, 2) still consider SQL session as the best way to do it and 3) are there better options out there for Azure. 如果我迁移到Azure,我是否1)仍然需要担心应用程序池回收,2)仍然将SQL会话视为实现此目的的最佳方法,并且3)有更好的Azure选项。

Thanks. 谢谢。

1) still need to worry about app pool recycles - YES. 1)仍然需要担心应用程序池回收-是的。 But you can configure the recycle interval. 但是您可以配置回收间隔。 By default IIS recycle app pools every 22 hours I think 我认为默认情况下,IIS每22小时会回收一次应用程序池

2) still consider SQL session as the best way to do it - YES. 2)仍然认为SQL会话是最好的方法-是。 And no (look the next question) 否(请看下一个问题)

3) are there better options out there for Azure. 3)Azure有更好的选择了。 - Depends, but you may consider using Windows Azure AppFabric Cache for Session State. -取决于,但您可以考虑将Windows Azure AppFabric缓存用于会话状态。

Take a look at: http://www.nuget.org/List/Packages/System.Web.Providers for providers for SQL Azure. 请查看: http : //www.nuget.org/List/Packages/System.Web.Providers,以了解SQL Azure的提供程序。 and http://msdn.microsoft.com/en-us/gg457897 for using Azure Appfabric Cache as Session State. http://msdn.microsoft.com/zh-cn/gg457897 (使用Azure Appfabric缓存作为会话状态)。

Edit: Considering limits for Azure AppFabric Cache , what I have confirmed for sure is that there is always one single connection for Azure AppFabric Cache from every azure instance. 编辑:考虑到Azure AppFabric缓存的限制 ,我已经确定要确定的是,每个Azure实例中的Azure AppFabric缓存始终只有一个连接。

Astaykov's answer is good. 阿斯塔耶夫的答案是好的。 In addition, note that Windows Azure uses affinity-less load balancing, which means that in-proc really isn't an option. 此外,请注意Windows Azure使用无亲缘关系的负载平衡,这意味着in-proc实际上不是一个选择。 (I might have a session on one server, but when I load the next page, I may land on a different server that doesn't have that session.) You really need to store the session somewhere that's shared by all the servers. (我可能在一台服务器上有一个会话,但是当我加载下一页时,我可能会降落在没有该会话的另一台服务器上。)您确实需要将会话存储在所有服务器共享的某个位置。 SQL or AF Cache are both good places. SQL或AF缓存都是不错的地方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM