Throttling request messages with WSO2 Data Services

WSO2 Data services 1.0 has been released now. This free and open source product consists of a lot of useful features which can be used to implement your SOA based systems with minimum effort.
Access throttling can be considered as a new and vital feature included in it.
In web services interactions, we usually have requirements to restrict number of requests our web services serve for a given client. Also, we need to allow service access to a specified domain or IP range.
WSO2 Data Services provides an easily configurable UI based utility to throttle messages targeted to a particular data service or a set of services.
This post will take you through a basic throttling configuration.

Pre-requisites
Download and install WSO2 Data Services 1.0

Step 1
Start server by running WSO2DS_HOME/bin/wso2server.bat{sh}
Access wso2 data service management console (https://localhost:9443/ds)
Log in to console with default admin credentials (admin/admin)
Select Data Services link in the left navigation menu. You will be directed to the Deployed Services page.
Click on the default service, CustomerService
You will see the following page.



Step 2

Click on Throttling link which is placed under Quality of Service in the above page.
Throttling Configuration for CustomerService Service page will be displayed.
Select "Yes" from Enable Throttling drop down.
Default throttling configuration will be displayed as follows.



In the above table, Range denotes the IP addresses and domains to be restricted.
Remove the second row of configuration table.
In this demonstration we will restrict accessing the default CustomerService to the requests originating from local host. Therefore you can leave "other" as the range "IP" as type.

There are three access levels.
Allow - All requests are allowed without applying any restriction for the specified range
Deny - Access is denied for all requests comes from the given range
Control - Restrictions are applied based on the given constraints (Max Request Count, unit time and prohibit time period)

In this demonstration, we are going to use "Control" access level. Hence, Change the Access level to "Control". Max Request Count, Unit time and prohibit time period text boxes will be enabled.

Enter 10 as Max Request Count. 100000 as Unit time and 20000 as prohibit time period.
This means, our sample data service (CustomerService) accepts only 10 requests from localhost during 100 seconds (100000ms) . If all 10 requests hits the server before unit time expires (before 100 seconds), no more requests are allowed in to the service within 20 seconds (20000ms) as specified in prohibit time period.

A more detailed explanation on these terms can be found in the inline help of WSO2 Data services management console.

Click on Finish button to save the throttle configuration.


Step 3

Our throttling configuration is over by now. Lets invoke the sample service 10 times and see how throttling works.
Go back to the service management page of the CustomerService and click on Try this Service link.
Select "customersInBoston" operation and click on "customersinBoston" button. Hit this button 10 times to send 10 requests to CustomerService.
Send one more request. You will receive a fault similar to the below.

Fault: Access deny for a caller with IP 127.0.0.1 : Reason : You cannot access this service since you have exceeded the allocated quota.

Comments

Anonymous said…
Perfect!!You are a outstanding person!Have you ever wore chaussures puma,Here are the most popular puma CAT,Puma shoes store gives some preview of puma speed cat,and casual but no sweat puma basket.
http://www.pumafr.com/blog
http://poloshirtsonline.blogspot.com
http://thediary.org/mensclothing
http://blog.livedoor.jp/dokoma
http://www.itimes.com/my_blog.php
Anonymous said…
God bless you!I really agree with your opinions.Also,there are some new fashion things here,gillette razor blades.gillette mach3 razor bladesfor men.As for ladies,gillette venus razor blades must the best gift for you in summer,gillette fusion blades are all the best choice for you.
http://community.fox2now.com/venusjj
http://cheappolos.blog.drecom.jp
http://d.hatena.ne.jp/crystal666
http://www2.atword.jp/pumaspeed
http://www.seriousblogging.com/basketspuma

Popular posts from this blog

WSO2 Stratos - Introducing WSO2 middleware Platform as a Service (PaaS)

Common mistakes to avoid in WSO2 ESB - 1 - "org.apache.axis2.AxisFault: The system cannot infer the transport information from the URL"

Working with HTTP multipart requests in soapUI