本文介绍了会话亲和性和粘性会话之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在负载平衡服务器的上下文中,会话亲缘关系粘性会话有什么区别?

What is the difference between session affinity and sticky session in context of load balancing servers?

推荐答案

我见过这些术语可以互换使用,但有不同的实现方式:

I've seen those terms used interchangeably, but there are different ways of implementing it:

  1. 在第一个响应中发送一个 cookie,然后在后续响应中查找它.cookie 说明要发送到哪个真实服务器.
    不好,如果您必须支持无 cookie 的浏览器
  2. 根据请求者的 IP 地址进行分区.
    不好,如果它不是静态的,或者很多都是通过同一个代理进入的.
  3. 如果您对用户进行身份验证,则根据用户名进行分区(必须是支持 HTTP 的身份验证模式才能执行此操作).
  4. 不需要状态.
    让客户端访问任何服务器(将状态发送到客户端并让他们将其发回)
    这不是一个粘性会话,而是一种避免必须这样做的方法.
  1. Send a cookie on the first response and then look for it on subsequent ones. The cookie says which real server to send to.
    Bad if you have to support cookie-less browsers
  2. Partition based on the requester's IP address.
    Bad if it isn't static or if many come in through the same proxy.
  3. If you authenticate users, partition based on user name (it has to be an HTTP supported authentication mode to do this).
  4. Don't require state.
    Let clients hit any server (send state to the client and have them send it back)
    This is not a sticky session, it's a way to avoid having to do it.

我怀疑 sticky 可能指的是 cookie 方式,而亲和性在某些情况下可能指的是 #2 和 #3,但这不是我看到它使用的方式(或我自己使用它)

I would suspect that sticky might refer to the cookie way, and that affinity might refer to #2 and #3 in some contexts, but that's not how I have seen it used (or use it myself)

这篇关于会话亲和性和粘性会话之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 09:45