“进程内”会话状态模式在多个服务器设置?

编程入门 行业动态 更新时间:2024-10-26 15:13:30
本文介绍了“进程内”会话状态模式在多个服务器设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的团队正在使用进程内会话状态模式在多个服务器设置。这似乎不是我的权利显然是因为会话状态将是每个服务器上唯一,不会被共享。

My Team is using 'in-proc' Session State mode on a multiple server setup. This does not seem right to me obviously because the session state is going to be unique on each server and will not be shared.

我们已经通过给两个服务器上相同的计算机密钥走近这个问题(在应用程序的配置文件。)但是我有一种感觉,这将不会真正帮助...

We have approached this problem by giving the same Machine Key on both servers (in the application's config file.) But I have a feeling this would not actually help...

在这个任何光线AP preciated。

Any light on this is appreciated.

谢谢!

推荐答案

在使用是InProc 会话状态,会话将在本地哪些服务请求的服务器上存储和因此,使用两台服务器上相同的计算机密钥不会达到目的。

When using InProc session state, the session will be stored locally on the server which served the request and therefore using the same Machine Key on both servers won't serve the purpose.

的此选项不适合在Web场环境中使用。一个农机存储会话状态而不是其他。来自同一个用户的后续Web请求可能无法读取正确的会话状态。的

考虑一个很常见的场景:

Consider a very common scenario:

想象一下Web请求路由到农机A和由请求调用code依赖于存储在会话中的一些参数。如果同一个用户,然后在接下来的web请求也依赖于会话状态发送到主机B,那么结果将是未predictable。

Imagine that the web request is routed to farm machine A and the code invoked by the request relies on some parameters stored in the session. If the same user is then routed to machine B in the next web request which also relies on the session state then the results will be unpredictable.

有一种叫做 StickySessions 的可以解决上面的场景。 这是真的好?

此功能意味着,如果一个客户端返回第二个请求,然后负载平衡器将流量重定向到同一Web服务器。它也被称为客户端关联。这可能是对于本地存储会话状态的Web服务器很重要,这样,当同一个访客回来那么我们不希望有关该用户的状态,因为请求路由到不同的网络服务器不可用。

This feature means that if a client returns for a second request then the load balancer will redirect that traffic to the same web server. It is also called client affinity. This can be important for web servers that store session state locally so that when the same visitor comes back then we don’t want the state relevant to that user to be unavailable because the request was routed to a different web server.

这肯定节拍负载均衡的网络farm.We的根本目的应该避免这种情况的解决方案,使负载均衡器可以根据当前负载挑选合适的机农场。

This definitely beats the very purpose of load balancing in a web farm.We should avoid this solution so that the load balancer can pick the "right" machine in a farm based on the current load.

在这里阅读完整的理解:的dotnetcodr/2013/07/01/web-farms-in-net-and-iis-part-5-session-state-management/

Read here for a complete understanding: dotnetcodr/2013/07/01/web-farms-in-net-and-iis-part-5-session-state-management/

更多推荐

“进程内”会话状态模式在多个服务器设置?

本文发布于:2023-06-10 22:56:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/620861.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多个   进程   状态   模式   服务器

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!