使用Azure Traffic Manager和会话状态存储进行负载平衡是否必要? [英] Load Balancing with Azure Traffic Manager and Session state store necessary?

查看:92
本文介绍了使用Azure Traffic Manager和会话状态存储进行负载平衡是否必要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Azure Traffic Manager来负载均衡不同区域中的两台服务器.我以为我的会话状态需要一个存储或Redis缓存.但是,在测试时,即使我通过测试我所在的服务器在服务器之间返回时,似乎也使我保持登录状态.我注销了,而我又注销了.我要存储的唯一会话状态是用户个人资料,但是如果找不到,它将直接进入服务器并进行抓取.以下是我的表单设置.我真的需要像redis cache这样的东西吗?

I am using Azure Traffic manager to load balance two servers in different regions. I thought I would need a single store or redis cache for my session state. However, while testing it seems to keep me logged in even when I go back between servers by testing which server I am on. I log out, and I am logged out on the other. The only session state I am storing is a user profile, but if it's not found it just goes to the server and grabs it. Below is my forms setup. Do I really need something like redis cache?

<sessionState timeout="2880" mode="InProc" />
    <authentication mode="Forms">
      <forms loginUrl="/login" path="/" protection="All" domain=".example.com" timeout="2880" slidingExpiration="true" name="_EXPOSURE_" />
    </authentication>

推荐答案

只有您可以决定如何设计应用程序,但是... Traffic Manager与会话状态完全无关.它只是根据选择的路由方法(距离/循环/主要+故障转移)将您的用户流量路由到多个Web端点.

Only you can decide how to design your app, but... Traffic Manager has nothing to do with session state at all. It just routes your user traffic to multiple web endpoints based on routing method chosen (distance / round robin / primary+failover).

您上面的会话状态代码段代表InProc,这意味着会话数据在给定VM上的Web服务器内部维护.它在VM外部共享.如果要跨多个VM(或Web应用程序)共享会话状态,则必须将会话状态存储在Web服务器外部.

Your session state snippet above represents InProc, which means that session data is maintained inside your web server on a given VM. It is not shared outside of the VM. If you want session state shared across multiple VMs (or web apps), you must store your session state external to the web server.

您是否使用Redis或SQL数据库,还是其他取决于您的情况.

Whether you use Redis, or SQL Database, or something else, is up to you.

这篇关于使用Azure Traffic Manager和会话状态存储进行负载平衡是否必要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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