Sticky session

转载地址: http://blog.touchhappy.com/technology/sticky-session/

Sticky sessions work with the load balancer to improve efficiency of Persistent Sessions in a clustered configuration.

In a clustered configuration, the load balancer sends requests to multiple backend Resin servers. Each session has an owning Resin server and a backup Resin server. The load balancer will send a session’s request to the owning server or to the backup if the owning server is not available. The association of a session with a backend server is called “sticky sessions”.

Because the load balancing occurs before any interpretation of the Virtual Host or Web Application, it’s a <server> configuration variable, with the <session-cookie> directive.


Sticky Session encoding

Sticky sessions encodes the session cookie with the owning server. The encoding using a simple prefix value. ‘a’ refers to the first server in the cluster, ‘b’ refers to the second server, …, ‘z’ refers to the 26th server.

So the session cookie JSESSIONID=cnn8x02mPph_4sOKlbn would go to the third server, 192.168.0.12 in the following configuration

<cluster>
  <srun id="a" host="192.168.0.10" port="6802"/>
  <srun id="b" host="192.168.0.11" port="6803"/>
  <srun id="c" host="192.168.0.12" port="6803"/>
</cluster>

Note that this encoding works with;jsessionid= as well, so a request to /test.jsp;jsesssionid=cnn8x02mPph_4sOKlbn would go to the third server.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值