The Throttle mechanism is used to control access to services at different levels. Throttling functionality is provided by the Throttle feature which is bundled by default in the Service Management feature of the WSO2 feature repository. The WSO2 Throttle feature provides an effective and efficient way to apply the throttle mechanism to your Web services.
Throttling can be enabled at 3 levels as follows. In all 3 levels, specific module engagement steps are the same from step 4 onwards in the service-level module engagement section described here.
- Global-Level - If it is enabled globally, the restrictions will be applied globally (for every message coming into the server). For information on how to access global-level access throttling configuration windows, refer to section Axis2 Module Management -> Configuring the 'wso2throttle' Module.
- If it is enabled only for an operation in a given service, restrictions are applied only for the messages accessing that particular operation. For information on how to access operation-level module configuration windows, refer to section Operation Management. -
- If it is enabled for a particular service, restrictions are applied to all the messages coming into that service.
Service-Level Access Throttling
Service-Level Access Throttling Service-Level Access Throttling
|Service-Level Access Throttling|
|Service-Level Access Throttling|
Use this function to add a throttle parameter that specifies a variable millisecond wait between calls or a variable maximum number of calls per unit of time. This would facilitate the smooth operation of Web services and REST using the Web service and HTTP client steps.
The throttling option is disabled by default. If you want to add the throttling mechanism, you should enable it.
Follow the instructions below to add throttling to a service.
1. Log on to the product's management console and select "List" under "Services."
2. The "Deployed Services" page appears. Select the service for which you want to enable throttling. For example,
3. The "Service Dashboard" page (for that service) appears. In the "Quality of Service Configuration" panel, click "Access Throttling."
4. The "Throttling Configuration" page appears. In the "Enable Throttling" list, select "Yes" from the drop-down menu.
Anchor 4 4
5. The existing throttle configuration appears in the wizard. Click "Add New Entry."
To enter new parameters or modify existing parameters, select "Allow" in the "Access" column.
Parameters for Throttling Configuration:
- Range - The IP address range or the domain is restricted from accessing the service. Requests from such clients will be restricted based on the specified values.
- Type - This indicates the type of Range. It can be IP or DOMAIN. It should be IP if the range is given as a single IP address or a range of IP addresses (for example, 10.100.1.30-10.100.1.60). It should be DOMAIN if the range is given as as a domain (for example, *.wso2.com). If you specify configurations types of both IP and DOMAIN, first priority will be given to DOMAIN level configurations.
- Maximum Request Count (MRC) - If Access is set to Control, it will be the maximum number of requests that are served within the time interval specified by the Unit Time parameter.
- Unit Time (UT) - The time period in milliseconds during which the maximum requests served. This is the number specified by the Maximum Request Count. The throttle starts counting the number of units from the moment it is enabled and the number of requests served within that period.
- Prohibit Time Period (PTP) - If the maximum request count is achieved before the unit time, this is the period during which no more requests are allowed to go in. By setting this value, the unit time slot is altered.
- Allow - Means that no restriction is applied for that range and all requests are allowed to go in as they come in.
- Deny - Means that access is completely denied for that range.
When the Access is set to Allow or Deny, MRC, UT and PTP parameters are not necessary and the said fields are deactivated. If it is Control, then the specified constraints are applied for that particular range.
MRC = 50
UT = 50000
PTP = 5000
If 50 requests are arrived within 35000ms (35s) in a particular time period, no more requests are taken in for another 5000ms (5s = PTP). This time, the UT is altered to 35000ms + 5000ms = 40000ms (40s)
7. If you set the parameters for a particular service, your configuration will be applied only to that particular service. On the other hand, if you reached this page from global configurations, these configurations will be applied globally.
8. Once done specifying the parameters, click "Finish." Throttling will be engaged for that particular service.
Functions of Buttons:
- Finish - Click "Finish" to submit the current data. When finished, your throttle configuration will be applied and the page will be redirected to the previous page.
- Reset - Click "Reset" to load the last submitted configuration.
- Default - Click "Default" to load the default throttle configuration. If you want to submit those data, you have to click Finish.
- Clear - Click "Clear" to clear all the text boxes in the user interface.
- Cancel - Click "Cancel" to go to the "Service Dashboard" page.
WSO2 access throttling configuration.