Selecting a Backend Server

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
 
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
 +
[[Category: HowTo]] [[Category: Cluster]]
 +
 
In testing situations, it can be important to select a particular backend server when making a request of the front-end server.  The easiest solution is to take advantage of [[sticky sessions]] and use the ";jsessionid=" url.
 
In testing situations, it can be important to select a particular backend server when making a request of the front-end server.  The easiest solution is to take advantage of [[sticky sessions]] and use the ";jsessionid=" url.
  
 
Supposed in the following cluster of three backend servers, you wanted to test the second one, i.e. the one listening to 192.168.0.11.  You could send a request to "/test.jsp;jsessionid=bXXXX".
 
Supposed in the following cluster of three backend servers, you wanted to test the second one, i.e. the one listening to 192.168.0.11.  You could send a request to "/test.jsp;jsessionid=bXXXX".
  
  <cluster>
+
=== resin.xml ===
   <srun id="a" host="192.168.0.10" port="6802"/>
+
 
  <srun id="b" host="192.168.0.11" port="6803"/>
+
  <resin xmlns="http://caucho.com/ns/resin">
  <srun id="c" host="192.168.0.12" port="6804"/>
+
    ...
</cluster>
+
   <cluster>
 +
    <server id="a" address="192.168.0.10" port="6800"/>
 +
    <server id="b" address="192.168.0.11" port="6801"/>
 +
    <server id="c" address="192.168.0.12" port="6802"/>
 +
      ...
 +
    </cluster>
 +
  </resin>
  
 
The 'b' will select the second server.  Because that request uses URL rewriting and also because "bXXXX" value is too short, Resin will generate a new session instead of using the cookie value of "bXXXX".
 
The 'b' will select the second server.  Because that request uses URL rewriting and also because "bXXXX" value is too short, Resin will generate a new session instead of using the cookie value of "bXXXX".
  
 
Note, the non-reuse of the session value "bXXXX" is affected by the <[[reuse-session-id]]> configuration.
 
Note, the non-reuse of the session value "bXXXX" is affected by the <[[reuse-session-id]]> configuration.

Latest revision as of 09:54, 14 January 2009


In testing situations, it can be important to select a particular backend server when making a request of the front-end server. The easiest solution is to take advantage of sticky sessions and use the ";jsessionid=" url.

Supposed in the following cluster of three backend servers, you wanted to test the second one, i.e. the one listening to 192.168.0.11. You could send a request to "/test.jsp;jsessionid=bXXXX".

resin.xml

<resin xmlns="http://caucho.com/ns/resin">
   ...
  <cluster>
    <server id="a" address="192.168.0.10" port="6800"/>
    <server id="b" address="192.168.0.11" port="6801"/>
    <server id="c" address="192.168.0.12" port="6802"/>
     ...
   </cluster>
 </resin>

The 'b' will select the second server. Because that request uses URL rewriting and also because "bXXXX" value is too short, Resin will generate a new session instead of using the cookie value of "bXXXX".

Note, the non-reuse of the session value "bXXXX" is affected by the <reuse-session-id> configuration.

Personal tools