I have set spike arrest policy as below:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <SpikeArrest async="false" continueOnError="false" enabled="true" name="Spike-Arrest-1"> <DisplayName>Spike Arrest-1</DisplayName> <Properties/> <Identifier ref="request.header.some-header-name"/> <MessageWeight ref="request.header.weight"/> <Rate>2pm</Rate> </SpikeArrest>
But i am able to send more then 2 requests per minute.
Can someone help to understand?
Hi @RKumar40, Spike Arrest is a way to generally protect against traffic spikes rather than as a way to limit traffic to a specific number of requests.
In your Spike arrest configuration Rate is 2 pm.
2 per minute. The policy smoothes the rate to 1 request allowed every 30 seconds (60/2). So if there is a second call in the first 30secs, it is going to be blocked.
By default, Spike Arrest is not distributed (unless you enable <UseEffectiveCount>😞 request counts are not synchronized across MPs. Please check below doc,
https://docs.apigee.com/api-platform/reference/policies/spike-arrest-policy#howspikearrestworks
If you want to restrict only specifically 2 calls per minute then you should be using Quota Policy.
Please check the documentation,
Hi @Siddharth Barahalikar I am also facing the same issue, whatever the rate i am specifying i,e 2pm, 5pm etc, i observed it is not being restricted to that number, even though i have set the flag <UseEffectiveCount> as true to make the spike arrest policy as distributed. But i am seeing the inconsistent behavior.
And to check how it works if i make <UseEffectiveCount> flag as false i.e to make the policy non-distributed i observed here also the behavior is not correct. I found out that my apiproxy deployment (with my apigee SaaS eval-account) has 4 Message Processors using Apigee Management APIs (As described here https://community.apigee.com/questions/51937/how-many-routers-and-message-processors-are-used-b.html..., thus when the rate is set to 2pm and with 4 MPs it should allow total 8 requests in one min i.e 2 requests per minute by each MPs.
Can you please confirm if you have also seen this kind of ambiguity.