Spike arrest - UseEffectiveCount - not working

Not applicable

In both the cases I am able to make more than 4 requests per ten seconds...

case 1: Without UseEffectiveCount

<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>6pm</Rate> </SpikeArrest>

Case 2: using UseEffectiveCount

<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>6pm</Rate> <UseEffectiveCount>true</UseEffectiveCount> </SpikeArrest>

I am try to understand how useEffectiveCount works... if UseEffectiveCount is set as true how many ever message processors... we can make only 1 request per 10 seconds {60(Seconds) divided by 6(requests)} in case 2. But i am able to make 4 request within span of 10 seconds.

my understanding on UseEffectiveCount is wrong? or my implementation is wrong(I have tried both case)?

Please help... thanks in advance

0 4 878
4 REPLIES 4

I have a feeling that you are trying to use SpikeArrest policy to implement Quota functionality but anyway here is what I think is happening here:

You are setting:

  • Rate: 6pm
  • UseEffectiveCount: true

In this setting, according to the documentation:

When <UseEffectiveCount> is set to true, an MP's spike rate limit is the <Rate> divided by the current number of MPs.

I don't know the number of MPs you have (you can see this from https://docs.apigee.com/management/apis/get/organizations/%7borg_name%7d/environments/%7benv_name%7d..., but assuming it is 4 (as you can push 4 requests in.

So 6pm/4 = 1.5pm which is ~1 request in 40 seconds per MP.

Again assuming roundrobin lb where each request will hit a different MP, you will get ~4 request in 40 seconds in total.

The functionality is kind of similar in spike and quota. From the documentation I got to know that to maintain central counter across all message processor we have to use "UseEffectiveCount" in case of spike and in case of quota we set "distributed" & "synchronous" to true.

I am using free version. According to 4 minute videos tutorials, the number of message processors will be 2.

Number of MPs being 2 doesn't change the calculations:

6pm/2=3pm which is ~1 request in 20 seconds per MP. So each MP will still reject the second request in 10 secs according to your scenario.

Perhaps it is best if you explain your requirements - that way we can try to find the correct policy to use with the right configuration (if supported).

Yes. I agree with you. Each MP will reject second request made with in 10 sec in this scenario. But its not rejecting.

To be frank there's no requirement... I was trying out "UseEffectiveCount"... since the expected output didn't match the actual output... I wanted to know where its going wrong...