简体   繁体   English

IIS Web Farm的防弹会话

[英]Bulletproof Sessions for IIS Web Farm

Good afternoon, all. 大家下午好。

We're currently making the jump from one web server to two and in order to provide seamless failover to our users we need to do something about the session. 我们目前正在从一个Web服务器跳转到两个,为了向我们的用户提供无缝故障转移,我们需要对会话做一些事情。

Currently, we're investigating three different methods. 目前,我们正在研究三种不同的方法。

  1. Make use of a state server 使用状态服务器
  2. Make use of SQL server 利用SQL服务器
  3. Chuck everything into hidden fields 将所有东西扔进隐藏的田地

I, personally, would like to see option number one go into place as we don't have a dedicated database for option number two and option number three seems like a messy hack. 我个人希望看到第一个选项到位,因为我们没有第二个选项的专用数据库,第三个选项似乎是一个混乱的黑客。

The problem I currently face is that my manager is not happy with the single point of failure provided by a state server (our SQL server is replicated, so no troubles there). 我目前面临的问题是我的经理对状态服务器提供的单点故障不满意(我们的SQL服务器被复制,所以没有麻烦)。

Is there something that can be done about replicating the state server or some such? 有没有什么可以做的复制状态服务器或其他一些?

It can be a pain, but I've decided to turn off Session and deal with the consequences. 这可能是一种痛苦,但我决定关闭Session并处理后果。 So far nothing insurmountable has come up. 到目前为止,还没有出现任何不可逾越的问题。

After some more investigation we've decided to go with the StateServer option. 经过一些调查,我们决定采用StateServer选项。 We're still looking to see how to overcome the single point of failure on the StateServer and we've turned up two further avenues of investigation. 我们仍然希望看到如何克服StateServer的单点故障,我们已经提出了另外两个调查途径。

Our first option is to use a third party program to handle the sessions. 我们的第一个选择是使用第三方程序来处理会话。 The one we're looking at right now is called nCache : I think there's another called ScaleOut that we also may take a look at. 我们现在正在看的那个叫做nCache :我认为还有一个名为ScaleOut的我们也可以看看。

Option number two is to use session state paritioning and we're currently looking into this option as well: http://msdn.microsoft.com/en-gb/magazine/cc163730.aspx 第二个选项是使用会话状态分区,我们目前也在考虑这个选项: http//msdn.microsoft.com/en-gb/magazine/cc163730.aspx

To my knowledge there is no way to back up or replicate your StateServer service. 据我所知,无法备份或复制StateServer服务。 Another issue when using StateServer in a web farm is if your cluster allows for the same browser to reach different machines on different requests they could have different session data on each request! 在Web场中使用StateServer时的另一个问题是,如果您的群集允许同一浏览器在不同请求上访问不同的计算机,则每个请求可能会有不同的会话数据! (edit: Martin pointed out below that you can fix this by sharing a single StateServer instance among multiple web servers). (编辑:Martin在下面指出,你可以通过在多个Web服务器之间共享一个StateServer实例来解决这个问题)。 For your purposes option 2 or 3 would be more fault tolerant, and I will throw in another idea: for small pieces of data try using cookies for session storage. 为了您的目的,选项2或3将更容错,我将提出另一个想法:对于小块数据尝试使用cookie进行会话存储。

I think that you are moving to another arquitecture: more than one Front End IIS. 我认为你正在转向另一个arquitecture:多个前端IIS。

Are you going to use NLB? 你打算用NLB吗?

  • If so, your best option is to use a state server, it will play as an application server in concept. 如果是这样,您最好的选择是使用状态服务器,它将作为概念中的应用程序服务器。

Here in my company we are migrating .NET app to two IIS with Network Load Balancing, and the applications use to have Session managment in proc. 在我的公司中,我们将.NET应用程序迁移到具有网络负载平衡的两个IIS,并且应用程序用于在proc中使用Session管理。

We've investigated that there was another alternative: 我们调查过还有另一种选择:

  • using client affinity in the NLB configuration, allowing the postback to go back to the IIS where the process was generated, the price was to loose all the NLB... 在NLB配置中使用客户端关联,允许回发返回到生成进程的IIS,价格是松散所有NLB ...

After Microsoft advisory, the best option was the State Server :) 在Microsoft咨询之后,最好的选择是State Server :)

Hope it helps! 希望能帮助到你!

Best Regards! 最好的祝福!

Also make sure that you aren't using SQL Server to store session state that just comes from the database anyway. 还要确保您没有使用SQL Server来存储仅来自数据库的会话状态。 If so, you might as well just call the database each time. 如果是这样,您也可以每次都调用数据库。

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

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