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 configuration

Throttling configuration uses the same model as rest of OpenHub framework, see External configuration model


Throttling can be disabled at all by setting ohf.disable.throttling parameter to value true.

Suitable throttling implementation is set by ohf.throttling.counter.impl parameter. There are the following built-in implementations:

  • org.openhubframework.openhub.core.throttling.ThrottleCounterMemoryImpl (default) - in-memory implementation, suitable for standalone server only
  • org.openhubframework.openhub.core.throttling.ThrottleCounterHazelcastImpl - implementation with Hazelcast shared map, suitable for cluster

Count limits 

The default configuration (that is always added as default) is the following:

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)


Property file configuration format and example (from application.properties):

###############################################################################
#  Throttling configuration
#
#   There the following property names:
#   - throttling.defaultInterval: default time interval (in seconds) if not defined by system/operation
#   - throttling.defaultLimit: default limit if not defined by system/operation
#   - throttling.sourceSystem.operationName, where
#       - sourceSystem is specific source system or '*' if any system
#            (source system is case-insensitive value from trace header (ExternalSystemExtEnum))
#       - operationName is specific operation name or '*' if any operation
#
#   Property values (except for default values) have the following format:
#       limit [/interval]
#
#   Examples:
#       throttling.crm.op1=10
#       throttling.crm.*=10/40
#       throttling.*.sendSms=60/30
###############################################################################

throttling.defaultInterval=60
throttling.defaultLimit=60
throttling.sourceSystem.*=300/60
throttling.*.syncHello=15/60
throttling.*.asyncHello=50/60

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.

Examples

throttling:sync:sendSms
throttling:async