API Gateway 10.11 | Using API Gateway | Policies | System-defined Stages and Policies | Traffic Monitoring | Traffic Optimization
 
Traffic Optimization
This policy limits the number of API invocations during a specified time interval, and sends alerts to a specified destination when the performance conditions are violated. You can use this policy to avoid overloading the back-end services and their infrastructure, to limit specific clients in terms of resource usage, and so on.
The Traffic Optimization policy generates two types of events when the specified limit is breached, policy violation event and monitor event. The policy violation event is for indicating the violations that occur for an API. If there are 100 violations, then 100 policy violation events are generated. The monitor event triggered by this policy is controlled by the alert frequency configuration specified in the policy.
The table lists the properties that you can specify for this policy:
Property
Description
Limit Configuration
Rule name
Specifies the name of throttling rule to be applied. For example, Total Request Count.
Operator
Specifies the operator that connects the rule to the value specified.
Select the operator: Greater Than. For example, in this case the throttling rule is applied when the Total Request Count is greater than (exceeds the limit specified for) the value specified in the Value field.
Value
Specifies the value of the request count beyond which the policy is violated.
When multiple requests are made at the same time, it might be possible that this limit applied to trigger an alert is not strictly adhered to. There is no loss observed in the invocation counts data, but there might be a minor delay in aggregating the count. The invocation count gets incremented, only when API Gateway receives the response from the native API. For example, if you have set the limit at 5 with an interval alert of 1 minute and if you invoke 5 requests in parallel, out of which for 1 of the request the native API delays sending the response to API Gateway. In such cases, the invocation count would still be 4 as the native API is yet to send the response to API Gateway. There is a minor delay in aggregating the count due to native API response delay. Hence, API Gateway allows additional invocation. However, when the invocation count exceeds 5 an alert is triggered.
Destination
Specifies the destination to log the alerts.
Select the required options:
*API Gateway
*API Portal
*CentraSite
Note:
This option is applicable only for the APIs published from CentraSite to API Gateway.
*Digital Events
*Elasticsearch
*Email (you can add multiple email addresses by clicking ).
Note:
If an email alias is available, you can type the email alias in the Email Address field with the following syntax, ${emailaliasname}. For example, if test is the email alias, then type ${test}.
*JDBC
*Local Log: You can select the severity of the messages to be logged (logging level) from the Log Level drop-down list. The available log levels are ERROR, INFO, and WARN.
Note: 
*Set the Integration Server Administrator's logging level for API Gateway to match the logging levels specified for the run-time actions (go to Settings > Logging > Server Logger). For example, if a Log Invocation action is set to the logging level of Error, you must also set Integration Server Administrator's logging level for API Gateway to Error. If the action's logging level is set to a low level (Warning-level or Information level), but Integration Server Administrator's logging level for API Gateway is set to a higher level (Error-level), then only the higher-level messages are written to the log file.
*Entries posted to the local log are identified by a product code of YAI and suffixed with the initial alphabet of the logging level selected. For example, for an error level, the entry appears as [YAI.0900.0002E].
*SNMP
*List of destinations configured using the Custom destinations section. For details on publishing to custom destinations, see How Do I Publish API-specific Traffic Monitoring Data to a Custom Destination?.
Alert Interval
Specifies the interval of time for the limit to be reached.
The timer starts once the first API is activated and resets after the configured time interval. If an API is deactivated the interval gets reset, and on API activation the time interval starts afresh.
Unit
Specifies the unit of measurement of the Alert Interval configured, to monitor performance, before sending an alert. For example:
*Minutes
*Hours
*Days
*Calendar Week. The time interval starts on the first day of the week and ends on the last day of the week. By default, the start day of the week is set to Monday.
For example:
*If an API is activated on a Wednesday and Alert Interval is set to 1, the time interval ends on Sunday, that is, 5 days.
*If an API is activated on a Wednesday and Alert Interval is set to 2, the time interval still ends on Sunday, but the period is two calendar weeks, that is 12 days.
You can change the start day of the week using the extended setting startDayOfTheWeek in the Administration > General > Extended settings section. Restart the API Gateway server for the changes to take effect.
*Calendar Month. The time interval starts on the first day of the month and ends on the last day of the month.
For example:
*If an API is activated in the month of August and Alert Interval is set to 1, the time interval ends on the last day of August.
*If an API is activated in the month of August and Alert Interval is set to 2, the time interval ends in two calendar months, that is on the last day of September.
Alert Frequency
Specifies the frequency at which the alerts are issued and the monitor events are logged.
Specify one of the options:
*Only Once. Triggers an alert every time the specified condition is violated and logs a monitor event for the alert interval specified.
*Every Time. Triggers an alert every time the specified condition is violated and logs multiple monitor events based on the number of API invocations.
Alert Message
Specifies the text message to be included in the alert.
Consumer Applications
Specifies the application to which this policy applies.
You can type a search term to match an application and click to add it.
You can add multiple applications or delete an added application by clicking .