Sunday, October 4, 2020

SAP API Management - Spike Arrest Policy

  Scenario: Suppose your backend system can handle 2 request per minute.

Steps:

1. Add an instance of Spike Arrest in Preflow for incoming request.




2. Modify the code as per requirement.

Code ( 2pm means in each 30 secs, only one call will be allowed)

<!-- This policy throttles the number of requests processed by an API Proxy protecting against performance lags and downtime -->

<SpikeArrest async="true" continueOnError="false" enabled="true" xmlns="http://www.sap.com/apimgmt">

<!-- can be used to uniquely identify an application or a client -->

<Rate>2pm</Rate>

<UseEffectiveCount>true</UseEffectiveCount>

</SpikeArrest>

3. Test the API. 

In this case, during 2nd call within 30 secs, the below response is received.





No comments:

Post a Comment