Author: hiranya
Date: Tue Nov 30 21:37:17 2010
New Revision: 1040783

URL: http://svn.apache.org/viewvc?rev=1040783&view=rev
Log:
sample 54, 55


Modified:
    
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample54.xml
    
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample55.xml

Modified: 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample54.xml
URL: 
http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample54.xml?rev=1040783&r1=1040782&r2=1040783&view=diff
==============================================================================
--- 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample54.xml
 (original)
+++ 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample54.xml
 Tue Nov 30 21:37:17 2010
@@ -23,7 +23,7 @@
         <title>Apache Synapse - Sample 54</title>
     </properties>
     <body>
-        <section name="Sample 54: ">
+        <section name="Sample 54: Session Affinity Load Balancing Between 3 
Endpoints">
             <div class="xmlConf">&lt;definitions 
xmlns="http://ws.apache.org/ns/synapse"&gt;
 
     &lt;sequence name="main" onError="errorHandler"&gt;
@@ -73,14 +73,22 @@
 &lt;/definitions&gt;</div>
             <subsection name="Objective">
                 <p>
-
+                    Showcase the ability of Synapse to act as a session aware 
load balancer with
+                    simple client sessions
                 </p>
             </subsection>
             <subsection name="Pre-requisites">
                 <p>
                     <ul>
                         <li>
-                            Deploy the SimpleStockQuoteService in the sample 
Axis2 server and start Axis2
+                            Deploy the LoadbalanceFailoverService in the 
sample Axis2 server (go to
+                            samples/axis2Server/src/LoadbalanceFailoverService 
and run 'ant')
+                        </li>
+                        <li>
+                            Start 3 instances of the Axis2 server on different 
ports as follows
+                            <div class="command">./axis2server.sh -http 9001 
-https 9005 -name MyServer1
+./axis2server.sh -http 9002 -https 9006 -name MyServer2
+./axis2server.sh -http 9003 -https 9007 -name MyServer3</div>
                         </li>
                         <li>
                             Start Synapse using the configuration numbered 54 
(repository/conf/sample/synapse_sample_54.xml)
@@ -93,11 +101,40 @@
                 </p>
             </subsection>
             <subsection name="Executing the Client">
-                <div class="command">ant stockquote 
-Daddurl=http://localhost:9000/services/SimpleStockQuoteService 
-Dtrpurl=http://localhost:8280/</div>
-
-                <div class="consoleOutput">Sat Nov 18 21:01:23 IST 2006 
SimpleStockQuoteService :: Generating quote for : IBM</div>
-
-                <div class="consoleOutput">Standard :: Stock price = 
$95.26454380258552</div>
+                <p>
+                    Above configuration is same as the load balancing 
configuration in
+                    <a href="sample52.html">sample 52</a>, except that the 
session type is specified
+                    as 'simpleClientSession'. This is a client initiated 
session, which means that
+                    the client generates the session identifier and sends it 
with each request. In
+                    this sample, client adds a SOAP header named ClientID 
containing the identifier
+                    of the client. Synapse binds this ID with a server on the 
first request and sends
+                    all successive requests containing that ID to the same 
server. Now switch to
+                    samples/axis2Client directory and run the client using the 
following command to
+                    check this in action.
+                </p>
+                <div class="command">ant loadbalancefailover 
-Dmode=session</div>
+                <p>
+                    In the session mode, client continuously sends requests 
with three different
+                    client (session) IDs. One ID is selected among these three 
IDs for each request
+                    randomly. Then client prints the session ID with the 
responded server for each
+                    request. Client output for the first 10 requests are shown 
below.
+                </p>
+                <div class="consoleOutput">[java] Request: 1 Session number: 1 
Response from server: MyServer3
+[java] Request: 2 Session number: 2 Response from server: MyServer2
+[java] Request: 3 Session number: 0 Response from server: MyServer1
+[java] Request: 4 Session number: 2 Response from server: MyServer2
+[java] Request: 5 Session number: 1 Response from server: MyServer3
+[java] Request: 6 Session number: 2 Response from server: MyServer2
+[java] Request: 7 Session number: 2 Response from server: MyServer2
+[java] Request: 8 Session number: 1 Response from server: MyServer3
+[java] Request: 9 Session number: 0 Response from server: MyServer1
+[java] Request: 10 Session number: 0 Response from server: MyServer1
+... </div>
+                <p>
+                    You can see that session ID 0 is always directed to the 
server named MyServer1.
+                    That means session ID 0 is bound to MyServer1. Similarly 
session 1 and 2 are bound
+                    to MyServer3 and MyServer2 respectively.
+                </p>
             </subsection>
         </section>
         <p><a href="../samples.html">Back to Catalog</a></p>        

Modified: 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample55.xml
URL: 
http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample55.xml?rev=1040783&r1=1040782&r2=1040783&view=diff
==============================================================================
--- 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample55.xml
 (original)
+++ 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample55.xml
 Tue Nov 30 21:37:17 2010
@@ -23,7 +23,7 @@
         <title>Apache Synapse - Sample 55</title>
     </properties>
     <body>
-        <section name="Sample 55: ">
+        <section name="Sample 55: Session Affinity Load Balancing Between 
Fail-over Endpoints">
             <div class="xmlConf">&lt;definitions 
xmlns="http://ws.apache.org/ns/synapse"&gt;
 
     &lt;sequence name="main" onError="errorHandler"&gt;
@@ -86,14 +86,23 @@
 &lt;/definitions&gt;</div>
             <subsection name="Objective">
                 <p>
-
+                    Demonstrate session aware load balancing in conjunction 
with fail-over 
+                    routing.
                 </p>
             </subsection>
             <subsection name="Pre-requisites">
                 <p>
                     <ul>
                         <li>
-                            Deploy the SimpleStockQuoteService in the sample 
Axis2 server and start Axis2
+                            Deploy the LoadbalanceFailoverService in the 
sample Axis2 server (go to
+                            samples/axis2Server/src/LoadbalanceFailoverService 
and run 'ant')
+                        </li>
+                        <li>
+                            Start 4 instances of the Axis2 server on different 
ports as follows
+                            <div class="command">./axis2server.sh -http 9001 
-https 9005 -name MyServer1
+./axis2server.sh -http 9002 -https 9006 -name MyServer2
+./axis2server.sh -http 9003 -https 9007 -name MyServer3
+./axis2server.sh -http 9004 -https 9008 -name MyServer4</div>
                         </li>
                         <li>
                             Start Synapse using the configuration numbered 55 
(repository/conf/sample/synapse_sample_55.xml)
@@ -106,11 +115,53 @@
                 </p>
             </subsection>
             <subsection name="Executing the Client">
-                <div class="command">ant stockquote 
-Daddurl=http://localhost:9000/services/SimpleStockQuoteService 
-Dtrpurl=http://localhost:8280/</div>
-
-                <div class="consoleOutput">Sat Nov 18 21:01:23 IST 2006 
SimpleStockQuoteService :: Generating quote for : IBM</div>
-
-                <div class="consoleOutput">Standard :: Stock price = 
$95.26454380258552</div>
+                <p>
+                    This configuration also uses 'simpleClientSession' to bind 
session ID values to
+                    servers as in <a href="sample54.html">sample 54</a>. But 
fail-over endpoints are
+                    specified as the child endpoints of the load balance 
endpoint. Therefore sessions
+                    are bound to the fail-over endpoints. Session information 
has to be replicated
+                    among the servers listed under each failover endpoint 
using some clustering
+                    mechanism. Therefore, if one endpoint bound to a session 
failed, successive requets
+                    for that session will be directed to the next endpoint in 
that failover group.
+                    Run the client using the following command to observe this 
behaviour.
+                </p>
+                <div class="command">ant loadbalancefailover 
-Dmode=session</div>
+                <p>
+                    You can see a client output as shown below.
+                </p>
+                <div class="consoleOutput">...
+[java] Request: 222 Session number: 0 Response from server: MyServer1
+[java] Request: 223 Session number: 0 Response from server: MyServer1
+[java] Request: 224 Session number: 1 Response from server: MyServer1
+[java] Request: 225 Session number: 2 Response from server: MyServer3
+[java] Request: 226 Session number: 0 Response from server: MyServer1
+[java] Request: 227 Session number: 1 Response from server: MyServer1
+[java] Request: 228 Session number: 2 Response from server: MyServer3
+[java] Request: 229 Session number: 1 Response from server: MyServer1
+[java] Request: 230 Session number: 1 Response from server: MyServer1
+[java] Request: 231 Session number: 2 Response from server: MyServer3
+...</div>
+                <p>
+                    Note that session 0 is always directed to MyServer1 and 
session 2 is directed to
+                    MyServer3. No requests are directed to MyServer2 and 
MyServer4 as they are kept
+                    as backups by fail-over endpoints. Now shutdown the server 
named MyServer1 while
+                    running the sample. You will observe that all successive 
requests for session 0
+                    is now directed to MyServer2, which is the backup server 
for MyServer1's group.
+                    This is shown below, where MyServer1 was shutdown after 
the request 534.
+                </p>
+                <div class="consoleOutput">...
+[java] Request: 529 Session number: 2 Response from server: MyServer3
+[java] Request: 530 Session number: 1 Response from server: MyServer1
+[java] Request: 531 Session number: 0 Response from server: MyServer1
+[java] Request: 532 Session number: 1 Response from server: MyServer1
+[java] Request: 533 Session number: 1 Response from server: MyServer1
+[java] Request: 534 Session number: 1 Response from server: MyServer1
+[java] Request: 535 Session number: 0 Response from server: MyServer2
+[java] Request: 536 Session number: 0 Response from server: MyServer2
+[java] Request: 537 Session number: 0 Response from server: MyServer2
+[java] Request: 538 Session number: 2 Response from server: MyServer3
+[java] Request: 539 Session number: 0 Response from server: MyServer2
+...</div>
             </subsection>
         </section>
         <p><a href="../samples.html">Back to Catalog</a></p>        


Reply via email to