Problem in Spike arrest policy

I have attached a spike arrest policy to my apiproxy and mentioned rate as 2pm and 1pm in both cases it allowing 8 request and i have not used identifier.

<SpikeArrest async="false" continueOnError="false" enabled="true" name="Spike-Arrest-1"> <DisplayName>Spike Arrest-1</DisplayName> <Rate>1pm</Rate> </SpikeArrest>

<SpikeArrest async="false" continueOnError="false" enabled="true" name="Spike-Arrest-1"> <DisplayName>Spike Arrest-1</DisplayName> <Rate>2pm</Rate> </SpikeArrest>

can any tell why spike arrest policy is not working as expected in both cases.

0 5 1,430
5 REPLIES 5

It depends on how many message processor you have. Are you on-premises or cloud ?

you can check <UseEffectiveCount> in attach link

https://docs.apigee.com/api-platform/reference/policies/spike-arrest-policy

ok i understand through table but how can strict only 2pm (1-requst per 30 sec) and made the message processor to 1 only.

if any thing wrong please correct it s possibe to keep constant message processor,

how can i find Effective Rate per MP

Hi @Dinesh Potti, 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).Soif 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,

https://docs.apigee.com/api-platform/develop/comparing-quota-spike-arrest-and-concurrent-rate-limit-...

ok i understand through table but how can strict only 2pm (1-requst per 30 sec) and made the message processor to 1 only.

if any thing wrong please correct it s possibe to keep constant message processor,

how can i find Effective Rate per MP

Are you using free version (apigee free cloud) OR on-premises ?

Generally they kept minimum 2 Message Processor's and you can increase it based on your requirement.

Now if you want to restrict exactly 1 request in every 30 seconds, i.e. not possible, as you have time slices in per second/minute/hour etc use can use 1pm and setting property

<UseEffectiveCount>true</UseEffectiveCount>

, so this will make sure 1 request in every 1 minute, even though you have multiple message processor.