Mantis - Resin
Viewing Issue Advanced Details
179 minor always 05-17-05 00:00 11-30-05 14:43
ferg  
 
normal  
closed 3.0.13  
3.0.13 fixed  
none    
none 3.0.14  
0000179: session cookie generation must allow for strict index
RSN-179
(rep by Anupam Bagchi)

Allow the session id generation to be strict, e.g. index='1' always produces aXXXXXXXX

Notes
(0000205)
ferg   
05-17-05 00:00   
server/01ig, server/01ih
(0000206)
sam   
05-17-05 00:00   
The configuration is <cookie-modulo-cluster>, it defaults to "true".
For "strict" assignment (as described in the bug report), it is set to false:

<session-config use-persistent-store="true">
  <cookie-modulo-cluster>false</cookie-modulo-cluster>
</session-config>

Typically, this should be left alone, and the default behaviour (described below) should be used.

When assigning a new session id, Resin encodes the cluster index of the server
in the first character. It does this so that on subsequent requests, the
request can be routed to the server that "owns" the session (sticky sessions).
The assignment is based on the index of the server in the cluster, and the number of servers in the cluster.

The default behaviour is to use modulus to assign any of a number of
letters as the encoded character.
 
For example, with 3 servers:

server 1 "a" or "d" or "g" or "j" or ...
server 2 "b" or "e" or "h" or "k" or ...
server 3 "c" or "f" or "i" or "l" or ...

Server 1 assigns "a" or "d" or "g" so that if a new server is added to the cluster, the existing sessions are immediately balanced across the new configuration:

server 1 "a" or "e" or "i" or ...
server 2 "b" or "f" or "j" or ...
server 3 "c" or "g" or "k" or ...
server 4 "d" or "h" or "l" or ...