会话亲和力和粘性会话之间的区别? [英] Difference between session affinity and sticky session?
本文介绍了会话亲和力和粘性会话之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在负载平衡服务器的上下文中,会话亲和力和粘性会话之间有什么区别?
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:
- 在第一个响应上发送一个cookie,然后在后续响应中查找它. Cookie会说明要发送到哪个真实服务器.
错误,如果您必须支持无cookie的浏览器 - 基于请求者的IP地址进行分区.
错误(如果它不是静态的,或者很多是通过同一代理服务器传入的). - 如果您对用户进行身份验证,请根据用户名进行分区(必须使用HTTP支持的身份验证模式来进行此操作).
- 不需要状态.
让客户端访问任何服务器(将状态发送到客户端,然后让他们发回)
这不是一个棘手的会话,而是一种避免这样做的方法.
- 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 - Partition based on the requester's IP address.
Bad if it isn't static or if many come in through the same proxy. - If you authenticate users, partition based on user name (it has to be an HTTP supported authentication mode to do this).
- 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.
我怀疑粘性可能是指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)
这篇关于会话亲和力和粘性会话之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文