Spike Arrest Policy : Variables are not getting updated

Hi Team,

We have a spike arrest policy. Rate is set at 10pm.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <SpikeArrest async="false" continueOnError="false" enabled="true" name="test_SpikeArrest"> <DisplayName>test_SpikeArrest</DisplayName> <FaultRules/> <Properties/> <Rate>10pm</Rate> </SpikeArrest>

However, when we check the below mentioned variables in trace.These values are not getting updated :

ratelimit.test_SpikeArrest.available.count

ratelimit.test_SpikeArrest.used.count

For first success , it will get updated as :

ratelimit.test_SpikeArrest.available.count : 9

ratelimit.test_SpikeArrest.used.count : 1

Then again, it will reset with in 6 secs as mentioned below :

ratelimit.test_SpikeArrest.available.count : 10

ratelimit.test_SpikeArrest.used.count : 0

Please suggest if this the expected behaviour.

Solved Solved
0 7 611
1 ACCEPTED SOLUTION

Hi @Neetu Garg,

I spoke to the engineering team and these variables are not useful when applied to the Spike Arrest policy. I will remove them from the doc.

Stephen

View solution in original post

7 REPLIES 7

Hi @Neetu Garg,

This is very much perfect behaviour from Apigee.

As per spike arrest policy the rate is divided into equal time capsules and checks for the number of requests in that span.

So in your case 10pm rate will become 1 minute * 60 Secs / 10 = 1 request per 6 seconds.

Please check the documentation of Spike Arrest Policy for details.

If you try to send more than 1 request per 6 seconds then SpikeArrest policy will raise a fault.

As per spike arrest purpose we do not maintain any counters. Setting of these variables seems like a quota behaviour, which might be due to some bug or something.

Hope this helps:)

Hello @Mohammed Zuber

Thank you for your reply.

However, The ques is not about the behaviour. The spike arrest policy is working fine.

As per the documentation link ,
http://docs.apigee.com/api-services/reference/spike-arrest-policy

The variables mentioned are not getting updated correctly.

The ratelimit.test_SpikeArrest.used.count should increase upto 10 before resetting.

The ratelimit.test_SpikeArrest.available.count : 10 shoulde decrease upto 0.

Please let us know your thoughts .

Thanks,

Neetu

@Neetu Garg I don't understand the significance of these variables. For exp: In your case(10pm), it 'll allow only 1 request in 6 secs time duration, if you send another request in that time period then your request will be rejected. If spike arrest default behavior was something like that in 1 min, 10 requests can be sent then it makes sense to maintain such counters. Let others come up with alternative view.

Hi @Neetu Garg,

I spoke to the engineering team and these variables are not useful when applied to the Spike Arrest policy. I will remove them from the doc.

Stephen

Thanks, @sgilson appreciate the efforts of APIGEE on keeping their docs updated 🙂

Thank you @sgilson

We were facing some issues in spike arrest and was looking at these variable so got confused.

Not applicable

Does the problem of Spike arrest policy variables not reflecting correct value still persist? I however see the correct behaviour based on my configuration for spike arrest policy. I am doing this on public cloud available freely.

My Configuration is :

<?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.allowed_quota"/--> <MessageWeight ref="request.header.weight"/> <Rate>6pm</Rate> <UseEffectiveCount>true</UseEffectiveCount> </SpikeArrest>

The corresponding variable populated is as follows for Abort case:

action ABORT
enforcement request
internal false
ratelimit.Spike-Arrest-1.allowed.count=6
ratelimit.Spike-Arrest-1.available.count =5

The value is same with success cases.

I however see it reflecting correctly with variables when we set the Rate in seconds .

@Anil Sagar