Author: hiranya
Date: Tue Nov 30 21:12:30 2010
New Revision: 1040775
URL: http://svn.apache.org/viewvc?rev=1040775&view=rev
Log:
sample 52, 53
Modified:
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample52.xml
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample53.xml
Modified:
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml
URL:
http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml?rev=1040775&r1=1040774&r2=1040775&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml
(original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml
Tue Nov 30 21:12:30 2010
@@ -60,7 +60,7 @@
<li><a href="samples/sample50.html">Sample 50: POX to
SOAP conversion</a></li>
<li><a href="samples/sample51.html">Sample 51: MTOM
and SwA optimizations and request/response correlation</a></li>
<li><a href="samples/sample52.html">Sample 52: Session
less load balancing between 3 endpoints</a></li>
- <li><a href="samples/sample53.html">Sample 53:
Failover sending among 3 endpoints</a></li>
+ <li><a href="samples/sample53.html">Sample 53:
Fail-over routing among 3 endpoints</a></li>
<li><a href="samples/sample54.html">Sample 54: Session
affinity load balancing between 3 endpoints</a></li>
<li><a href="samples/sample55.html">Sample 55: Session
affinity load balancing between fail over endpoints</a></li>
<li><a href="">Sample 56: WSDL endpoint</a></li>
Modified:
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample52.xml
URL:
http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample52.xml?rev=1040775&r1=1040774&r2=1040775&view=diff
==============================================================================
---
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample52.xml
(original)
+++
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample52.xml
Tue Nov 30 21:12:30 2010
@@ -23,7 +23,7 @@
<title>Apache Synapse - Sample 52</title>
</properties>
<body>
- <section name="Sample 52: ">
+ <section name="Sample 52: Session-less Load Balancing Between 3
Endpoints">
<div class="xmlConf"><definitions
xmlns="http://ws.apache.org/ns/synapse">
<sequence name="main" onError="errorHandler">
@@ -72,14 +72,22 @@
</definitions></div>
<subsection name="Objective">
<p>
-
+ Demonstrate the ability of Synapse to act as a load
balancer for a set of
+ servers hosting stateless services
</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 52
(repository/conf/sample/synapse_sample_52.xml)
@@ -92,11 +100,49 @@
</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>
+ Invoke the sample client as follows
+ </p>
+ <div class="command">ant loadbalancefailover -Di=100</div>
+ <p>
+ This will send 100 requests to the
LoadbalanceFailoverService through Synapse.
+ Synapse will distribute the load among the three endpoints
mentioned in the
+ configuration in round-robin manner.
LoadbalanceFailoverService appends the name
+ of the server to the response, so that client can
determine which server has
+ processed the message. If you examine the console output
of the client, you can
+ see that requests are processed by three servers as
follows:
+ </p>
+ <div class="consoleOutput">[java] Request: 1 ==> Response
from server: MyServer1
+[java] Request: 2 ==> Response from server: MyServer2
+[java] Request: 3 ==> Response from server: MyServer3
+[java] Request: 4 ==> Response from server: MyServer1
+[java] Request: 5 ==> Response from server: MyServer2
+[java] Request: 6 ==> Response from server: MyServer3
+[java] Request: 7 ==> Response from server: MyServer1
+...</div>
+ <p>
+ Now run the client without the -Di=100 parameter to send
requests indefinitely.
+ While running the client shutdown the server named
MyServer1. Then you can observe
+ that requests are only distributed among MyServer2 and
MyServer3. Console output
+ before and after shutting down MyServer1 is listed below
(MyServer1 was shutdown
+ after request 63):
+ </p>
+ <div class="consoleOutput">...
+[java] Request: 61 ==> Response from server: MyServer1
+[java] Request: 62 ==> Response from server: MyServer2
+[java] Request: 63 ==> Response from server: MyServer3
+[java] Request: 64 ==> Response from server: MyServer2
+[java] Request: 65 ==> Response from server: MyServer3
+[java] Request: 66 ==> Response from server: MyServer2
+[java] Request: 67 ==> Response from server: MyServer3
+...</div>
+ <p>
+ Now restart MyServer1. You can observe that requests will
be again sent to all
+ three servers within 60 seconds. This is because we have
specified
+ <suspendDurationOnFailure> as 60 seconds in the
configuration. Therefore,
+ load balance endpoint will suspend any failed child
endpoint only for 60 seconds
+ after detecting the failure.
+ </p>
</subsection>
</section>
<p><a href="../samples.html">Back to Catalog</a></p>
Modified:
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample53.xml
URL:
http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample53.xml?rev=1040775&r1=1040774&r2=1040775&view=diff
==============================================================================
---
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample53.xml
(original)
+++
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample53.xml
Tue Nov 30 21:12:30 2010
@@ -23,7 +23,7 @@
<title>Apache Synapse - Sample 53</title>
</properties>
<body>
- <section name="Sample 53: ">
+ <section name="Sample 53: Fail-over Routing Among 3 Endpoints">
<div class="xmlConf"><definitions
xmlns="http://ws.apache.org/ns/synapse">
<sequence name="main" onError="errorHandler">
@@ -72,14 +72,23 @@
</definitions></div>
<subsection name="Objective">
<p>
-
+ Demonstrate the fail-over routing capabilities of Synapse.
In fail-over routing
+ messages are sent to a designated primary endpoint. When
the primary endpoint
+ fails, Synapse fails over to the one of the backup
endpoints.
</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 53
(repository/conf/sample/synapse_sample_53.xml)
@@ -92,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 sends messages with the fail-over
behavior. Initially the
+ server at port 9001 is treated as primary and other two
are treated as backups.
+ Messages are always directed only to the primary server.
If the primary server
+ fails, next listed server is selected as the primary.
Thus, messages are sent
+ successfully as long as there is at least one active
server. To test this, run
+ the loadbalancefailover client to send infinite requests
as follows:
+ </p>
+ <div class="command">ant loadbalancefailover</div>
+ <p>
+ You can see that all requests are processed by MyServer1.
Now shutdown MyServer1
+ and inspect the console output of the client. You will
observe that all subsequent
+ requests are processed by MyServer2. (MyServer 1 was
shutdown after request 127)
+ </p>
+ <div class="consoleOutput">...
+[java] Request: 125 ==> Response from server: MyServer1
+[java] Request: 126 ==> Response from server: MyServer1
+[java] Request: 127 ==> Response from server: MyServer1
+[java] Request: 128 ==> Response from server: MyServer2
+[java] Request: 129 ==> Response from server: MyServer2
+[java] Request: 130 ==> Response from server: MyServer2
+...</div>
+ <p>
+ You can keep on shutting servers down like this. Client
will get a response untill
+ you shutdown all listed servers. Once all servers are
shutdown, the error sequence
+ is triggered and a fault message is sent to the client as
follows.
+ </p>
+ <div class="consoleOutput">[java] COULDN'T SEND THE MESSAGE TO
THE SERVER.</div>
+ <p>
+ Once a server is detected as failed, it will be added to
the active servers
+ list again after 60 seconds (specified in
<suspendDurationOnFailure> in
+ the configuration). Therefore, if you have restarted any
of the stopped servers,
+ messages will be directed to the newly started server
within 60 seconds.
+ </p>
</subsection>
</section>
<p><a href="../samples.html">Back to Catalog</a></p>