throttling


Component for throttling functionality. 

Throttling is functionality that checks count of input requests to integration platform and if this count exceeds defined limit then new requests are restricted.

Main goal of throttling is to limit disproportionate (and often wilful) overload of integration platform with huge amount of input requests for processing. This would have bad impact to application performance and even it can stop processing of current messages.

Throttling component counts input requests from specified source (external) system and for specific operation. If this count exceeds defined limit in defined time interval then OpenHub will start to reject new input requests (only requests from specified source system and for specified operation) - exception is thrown.

Throttling can be disabled at all by setting disable.throttling parameter in application.cfg to value true.

Throttling configuration

Default configuration is in throttlingCore.cfg file placed in core module. Configuration file throttling.properties placed in web-admin module has higher priority and therefore parameters in this file can override parameters from throttlingCore.cfg file.

throttlingCore.cfg content:

throttling.defaultInterval = 60
throttling.defaultLimit = 60

 

Use the following parameters for throttling configuration:

  • throttling.defaultInterval: default time interval in seconds. Default value is 60s.
  • throttling.defaultLimit: default max. count of requests for specified time interval. Default value is 60.
  • throttling.sourceSystem.operationName, where
    • sourceSystem identifies source (callee) system. Can be used specific system names (defined with org.openhubframework.openhub.api.entity.ExternalSystemExtEnum) or use asterix (*) that represents any source system. Then only requests with specific operations are checked. 
    • operationName identifies operation. Can be also used asterix (*) that represents any operation. Then only requests from source systems are checked. 


Parameter throttling.sourceSystem.operationName has the format limit [/interval]:

  • limit specifies max. count of requests for specific combination source system vs. operation
  • interval specifies time interval (in seconds). If not defined then value from throttling.defaultLimit parameter is used.

 

Examples:

throttling.crm.op1=10  (restriction to calls of operation op1 from CRM system to 10 requests for 60 seconds)

throttling.crm.*=10/40 (restriction to calls of any operation from CRM system to 10 requests for 40 seconds)

throttling.*.sendSms=60/30 (restriction to calls of operation sendSms from any system to 60 requests for 30 seconds)

Configuration via JMX

Throttling parameters is allowed to configured via JMX, for example with jconsole tool:

URI format

throttling:requestType[:operationName]

Options

ParameterDefaultDescription
requestType 

Specifies request type, e.g. SYNC (=synchronnous request) or ASYNC (=asynchronnous request)

Throttling component for asynchronnous request is used in route AsynchInMessageRoute for processing all input asynch. requests.

operationName operation name, e.g. "createCustomer" (mandatory for SYNC request type only)

Prerequisites

Throttling component needs reference to org.openhubframework.openhub.spi.throttling.ThrottlingProcessor that needs (in default implementation) reference to org.openhubframework.openhub.spi.throttling.ThrottlingConfiguration and org.openhubframework.openhub.spi.throttling.ThrottleCounter.

Common Spring configuration (sp_camel_services.xml):

    <bean id="throttlingConfiguration" class="org.openhubframework.openhub.core.throttling.ThrottlingPropertiesConfiguration">
        <constructor-arg ref="confProperties"/>
        <property name="throttlingDisabled" value="${disable.throttling}"/>
    </bean>
    <bean class="org.openhubframework.openhub.core.throttling.ThrottleCounterMemoryImpl" />
    <bean class="org.openhubframework.openhub.core.throttling.ThrottleProcessorImpl" />

where confProperties is reference to PropertiesFactoryBean with throttling configuration file (spring-ws-servlet.xml).

    <bean id="confProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="ignoreResourceNotFound" value="true"/>
        <property name="locations">
            <list>
                <value>classpath:applicationCore.cfg</value>
				...
                <value>classpath:throttlingCore.cfg</value>
                <value>classpath:throttling.cfg</value>
                <value>classpath:throttling0.cfg</value>
            </list>
        </property>
    </bean>

Examples

throttling:sync:sendSms
throttling:async