Apigee Quota Limit not working

I have the following configuration for quota limit policy which allows 5 requests in 15 minutes. This is in a shared flow and is being used in 3 proxies. However, this is not being strictly applied since sometimes, user is able to send requests after ~10 minutes post the first request is sent. 

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Quota continueOnError="true" enabled="true" name="QuotaLimit" type="flexi">
    <DisplayName>QuotaLimit</DisplayName>
    <Properties/>
    <DisplayName>Quota-1</DisplayName>
    <Properties/>
    <Identifier ref="request.header.phone"/>
    <Allow count="5"/>
    <Interval>15</Interval>
    <TimeUnit>minute</TimeUnit>
    <Distributed>true</Distributed>
    <Synchronous>true</Synchronous>
</Quota>

 

I am expecting the quota limit to be reset only after 15 minutes from the first request made once 5 requests are made altogether. But below issue happens.

1. Send 3 requests consecutively at 8:00 AM

2. Send 2 more requests at 8:10 AM after which I am blocked

3. I am able to send requests again at ~8:12 AM (~ 10 minutes after)

I am not able to see what the actual issue is. Can anyone help me in this. Thanks in advance.

@dchiesa1 @apietra @API-Evangelist 

0 4 299
4 REPLIES 4

Given you're using the flexi type, it should be working as you're expecting. To clarify, which version of Apigee are you using?

I am using Apigee X. I have updated the description to add that the quota limit was applied using a shared flow which is being used by 3 proxies. I read the below in https://cloud.google.com/apigee/docs/api-platform/reference/policies/quota-policy#:~:text=Using%20Qu...

abhijithsh_0-1681796946080.png

 

T think this probably has to do something with the <Identifier> tag you are using. It will keep a different counter for each value it receives in the variable "request.header.phone". What that means is that phone1 will have 15 requests in 5 minutes and phone2 will have 15 requests too. Are you able to make over 15 request in 5 minutes for the same value of "request.header.phone"?

I haven't been able to reproduce your issue. For me, for each API and for each identifier a separate bucket is maintained with their own expiry time. Also, if you use debug mode, you can see an expiry.time variable against the quota policy which contains when the 15 minutes expires for the given bucket. You can use this to verify what's happening / when the expiry is set to.

 muq_ash may have a point, double check the request header which you've defined as your identifier is set as expected.