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

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

05-17-05 00:00   
server/01ig, server/01ih
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">

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 ...