Apigee Edge - 4MV4D - Quota Policy - Rolling Window Type - S02E07

Hello Apigeeks,

In this 4MV4D, Find out how rolling window Quota policy works in Apigee Edge hands-on. In general Quota policy works based on interval & resetting the Quota once the interval reaches the defined limit. For example, If you say 2 requests / minute. Quota counter resets start of every minute & If quota is exhausted within a minute error is raised in Apigee Edge.

In rolling window type, there is no quota reset after defined interval. It calculates quota dynamically on every request based on last window. For example, API requests comes to Apigee Edge at 08 : 30 AM & we are using rolling window quota of 3 requests / 2 hours. Apigee edge looks for how many API calls processed in last 2 hours window i.e number of API calls processed between 06 : 30 AM & 08 : 30 AM. If the count is more than or equal to 3 it raises Quota Limit violation error. If it’s less than 3, it allows requests to reach target server.

See Quota Policy used in this 4MV4D video below that shows Quota Policy rolling window in action.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Quota async="false" continueOnError="false" enabled="true" name="Quota-1" type="rollingwindow">
    <DisplayName>Quota-1</DisplayName>
    <Properties/>
    <Allow count="3"/>
    <Interval>2</Interval>
    <Distributed>true</Distributed>
    <Synchronous>true</Synchronous>
    <TimeUnit>hour</TimeUnit>
</Quota>
	

For example in normal Quota Policy let’s say 3 / 2 hours, Present time is 08 : 30 AM, Quota is applied based developer app

  • First request at 08:32 AM - Allowed to backend
  • Second request 08:36 AM - Allowed to backend
  • Third request 08:40 AM - Allowed to backend
  • Fourth request 08:42 AM - Quota Limit Error
  • Fifth request 08:50 AM - Quota Limit Error
  • Sixth request 09:10 AM - Quota Limit Error
  • Seventh request 09:30 AM - Quota Limit Error
  • ….

10 : 30 AM , Quota counter resets

  • Request at 10:32 AM - Allowed to backend
  • Second request 10:35 AM - Allowed to backend
  • Third request 10:42 AM - Allowed to backend
  • Fourth request 10:45 AM - Quota Limit Error

Let’s see sample example in rolling window 3 / 2 hours, Present time in 08 : 30 AM

  • First request at 08:40 AM - Number of successful requests in last 2 hours - 0 - Allowed to backend
  • Second request 10: 28 AM - Number of successful requests in last 2 hours - 1 - Allowed to backend
  • Request at 10:30 AM - Number of successful requests in last 2 hours - 2 - Allowed to backend
  • Request at 10:35 AM - Number of requests in last 2 hours - 3 - Quota Limit Error
  • Request at 10:41 AM - Number of requests in last 2 hours - 2 - Allowed to backend
  • Request at 12:29 AM - Number of requests in last 2 hours - 2 - Allowed to backend

As you can see above, Difference between how normal quota policy & rolling window type quota policy works. Will this difference in behavior have any effect on backend systems? We don't know - that depends on what the backend system looks like. Surely the rolling window is more restrictive.

4MV4D videos are completely focussed on API Developers & Help you learn many interesting concepts very quickly using hands-on approach. Don't forget to subscribe to channel here & share same with your friends / colleagues who are interested in Apigee.


Feel free to send your feedback/queries using comments below or Ask a question if you have any query. Stay tuned for more videos.

Version history
Last update:
‎03-09-2017 10:16 PM
Updated by: