You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by hi...@apache.org on 2010/12/27 06:18:27 UTC

svn commit: r1052999 - in /synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide: samples.xml samples/sample364.xml samples/sample370.xml samples/sample371.xml samples/sample372.xml

Author: hiranya
Date: Mon Dec 27 05:18:27 2010
New Revision: 1052999

URL: http://svn.apache.org/viewvc?rev=1052999&view=rev
Log:
throttling samples

Modified:
    synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml
    synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample364.xml
    synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample370.xml
    synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample371.xml
    synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample372.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=1052999&r1=1052998&r2=1052999&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 Mon Dec 27 05:18:27 2010
@@ -145,15 +145,15 @@
                         <li><a href="samples/sample361.html">Sample 361: Introduction to dbreport mediator</a></li>
                         <li><a href="samples/sample362.html">Sample 362: Perform database lookups and updates in the same mediation sequence</a></li>
                         <li><a href="samples/sample363.html">Sample 363: Reusable database connection pools</a></li>
-                        <li><a href="#Sample364">Sample 364: Executing database Stored Procedures</a></li>
+                        <li><a href="samples/sample364.html">Sample 364: Executing database Stored Procedures</a></li>
                     </ul>
                 </p>
                 <h4>Throttle Mediator</h4>
                 <p>
                     <ul>
-                        <li><a href="#Sample370">Sample 370: Introduction to throttle mediator and concurrency throttling</a></li>
-                        <li><a href="#Sample371">Sample 371: Restricting requests based on policies</a></li>
-                        <li><a href="#Sample372">Sample 372: Use of both concurrency throttling and request rate based throttling </a></li>
+                        <li><a href="samples/sample370.html">Sample 370: Introduction to throttle mediator and concurrency throttling</a></li>
+                        <li><a href="samples/sample371.html">Sample 371: Restricting requests based on policies</a></li>
+                        <li><a href="samples/sample372.html">Sample 372: Use of both concurrency throttling and request rate based throttling </a></li>
                     </ul>
                 </p>
                 <h4>Class Mediator (Writing Mediation Logic in Java)</h4>

Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample364.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample364.xml?rev=1052999&r1=1052998&r2=1052999&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample364.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample364.xml Mon Dec 27 05:18:27 2010
@@ -23,7 +23,7 @@
         <title>Apache Synapse - Sample 364</title>
     </properties>
     <body>
-        <section name="Sample 364: ">
+        <section name="Sample 364: Executing Database Stored Procedures">
             <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
 
     &lt;sequence name="main"&gt;
@@ -90,13 +90,16 @@
 &lt;/definitions&gt;</div>
             <subsection name="Objective">
                 <p>
-
+                    Demonstrate how to invoke a database stored procedure from Synapse
                 </p>
             </subsection>
             <subsection name="Pre-requisites">
                 <p>
                     <ul>
                         <li>
+                            Setup a MySQL database as described in the database setup guide
+                        </li>
+                        <li>
                             Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
                         </li>
                         <li>
@@ -110,11 +113,24 @@
                 </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 scenario is very similar to <a href="sample363.html">sample 363</a>, but makes
+                    use of stored procedures to lookup and update the database instead of simple
+                    SQL queries. Note that we are still using the dblookup and dbreport mediators
+                    to access the database but the statements are simply calling a stored procedure in
+                    MySQL (the syntax to call a stored procedue is database engine specific).
+                </p>
+                <p>
+                    To try this sample out, invoke the sample client as follows.
+                </p>
+                <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=IBM</div>
+                <p>
+                    Synapse will invoke the two stored procedures as the response is mediated back
+                    to the client. You will see the following output on the Synapse console.
+                </p>
+                <div class="consoleOutput">INFO LogMediator text = ** Looking up from the Database ** ...
+INFO LogMediator text = Company ID - c1 ...
+INFO LogMediator text = Stock price - 183.3635460215262</div>
             </subsection>
         </section>
         <p><a href="../samples.html">Back to Catalog</a></p>        

Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample370.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample370.xml?rev=1052999&r1=1052998&r2=1052999&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample370.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample370.xml Mon Dec 27 05:18:27 2010
@@ -23,7 +23,7 @@
         <title>Apache Synapse - Sample 370</title>
     </properties>
     <body>
-        <section name="Sample 370: ">
+        <section name="Sample 370: Introduction to Throttle Mediator and Concurrency Throttling">
             <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
 
     &lt;sequence name="main"&gt;
@@ -71,7 +71,8 @@
 &lt;/definitions&gt;</div>
             <subsection name="Objective">
                 <p>
-
+                    Showcase the ability of Synapse to throttle incoming requests based on the
+                    concurrency level
                 </p>
             </subsection>
             <subsection name="Pre-requisites">
@@ -91,11 +92,23 @@
                 </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 specifies a throttle mediator inside the in mediator.
+                    Therefore, all request messages directed to the main sequence will be subjected
+                    to throttling. Throttle mediator has 'policy', 'onAccept' and 'onReject' tags at
+                    top level. The 'policy' tag specifies the throttling policy for throttling messages.
+                    This sample policy only contains a component called 'MaximumConcurrentAccess'.
+                    This indicates the maximum number of concurrent requests that can pass through
+                    Synapse on a single unit of time. To test concurrency throttling, it is required
+                    to send concurrent requests to Synapse. With this configuration if Synapse receives
+                    20 requests concurrently from clients, then approximately half of those will succeed
+                    while the others being throttled. The client command to try this is as follows.
+                </p>
+                <div class="command">ant stockquote -Dsymbol=IBM -Dmode=quote -Daddurl=http://localhost:8280/</div>
+                <p>
+                    It's not that easy to try this sample out using the sample Axis2 client. For
+                    better results, consider using a load testing tool like Apache Bench or Java Bench.
+                </p>
             </subsection>
         </section>
         <p><a href="../samples.html">Back to Catalog</a></p>        

Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample371.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample371.xml?rev=1052999&r1=1052998&r2=1052999&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample371.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample371.xml Mon Dec 27 05:18:27 2010
@@ -23,7 +23,7 @@
         <title>Apache Synapse - Sample 371</title>
     </properties>
     <body>
-        <section name="Sample 371: ">
+        <section name="Sample 371: Restricting Requests Based on Policies">
             <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
 
     &lt;sequence name="main"&gt;
@@ -117,7 +117,7 @@
 &lt;/definitions&gt;</div>
             <subsection name="Objective">
                 <p>
-
+                    Demonstrate how to throttle incoming requests based on complex policies
                 </p>
             </subsection>
             <subsection name="Pre-requisites">
@@ -137,11 +137,38 @@
                 </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 specifies a throttle mediator inside the in mediator.
+                    Therefore, all request messages directed to the main sequence will be subjected
+                    to throttling. Throttle mediator has policy, onAccept and onReject tags at the
+                    top level. Policy tag specifies the throttling policy against which all messages
+                    will be evaluated. It contains some IP address ranges and the maximum number of
+                    messages to be allowed for those ranges within a time period given in 'UnitTime'
+                    tag. 'ProhibitTimePeriod' tag specifies the time period to prohibit further
+                    requests after the received request count exceeds the specified time. Now run the
+                    client 5 times repetitively using the following command to see how throttling works.
+                </p>
+                <div class="command">ant stockquote -Dsymbol=IBM -Dmode=quote -Daddurl=http://localhost:8280/</div>
+                <p>
+                    For the first four requests you will get the quote prices for IBM as follows.
+                </p>
+                <div class="consoleOutput">[java] Standard :: Stock price = $177.20143371883802</div>
+                <p>
+                    Fifth request will not be sent to the Axis2 server and the client will receive
+                    the following fault.
+                </p>
+                <div class="consoleOutput">[java] org.apache.axis2.AxisFault: **Access Denied**</div>
+                <p>
+                    Maximum number of requests within 800000 milliseconds is specified as 4 for any
+                    server (including localhost) other than the explicitly specified ones. Therefore,
+                    our fifth request is denied by the throttle mediator. You can verify this by looking
+                    at the Synapse console.
+                </p>
+                <div class="consoleOutput">[HttpServerWorker-1] INFO  LogMediator - text = **Access Accept**
+[HttpServerWorker-2] INFO  LogMediator - text = **Access Accept**
+[HttpServerWorker-3] INFO  LogMediator - text = **Access Accept**
+[HttpServerWorker-4] INFO  LogMediator - text = **Access Accept**
+[HttpServerWorker-5] INFO  LogMediator - text = **Access Denied**</div>
             </subsection>
         </section>
         <p><a href="../samples.html">Back to Catalog</a></p>        

Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample372.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample372.xml?rev=1052999&r1=1052998&r2=1052999&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample372.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample372.xml Mon Dec 27 05:18:27 2010
@@ -23,7 +23,7 @@
         <title>Apache Synapse - Sample 372</title>
     </properties>
     <body>
-        <section name="Sample 372: ">
+        <section name="Sample 372: Use of Concurrency Throttling and Request Rate Based Throttling">
             <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
 
     &lt;registry provider="org.apache.synapse.registry.url.SimpleURLRegistry"&gt;
@@ -74,7 +74,8 @@
 &lt;/definitions&gt;</div>
             <subsection name="Objective">
                 <p>
-
+                    Showcase how to use the concurrency throttling in conjunction with request rate
+                    throttling
                 </p>
             </subsection>
             <subsection name="Pre-requisites">
@@ -94,11 +95,23 @@
                 </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 is a combination of <a href="sample370.html">sample 370</a> and
+                    <a href="sample371.html">sample 371</a>. In this case the throttle policy is loaded
+                    from the 'throttle_policy.xml' file which is fetched from the registry. To verify
+                    the functionality, it requires running a load test. The all enabled request from
+                    the concurrency throttling will be controlled by the access rate base throttling
+                    according to the policy.
+                </p>
+                <p>
+                    Run the client as follows.
+                </p>
+                <div class="command">ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy</div>
+                <p>
+                    You will get same results as in <a href="sample371.html">sample 371</a>. If you
+                    run the load test, results will be different due to the effect of concurrency
+                    throttling.
+                </p>                
             </subsection>
         </section>
         <p><a href="../samples.html">Back to Catalog</a></p>