In a Quota/Reset Quota policy, how do Identifier and Class interact?

In a Quota/Rest Quota policy, I know I can create quota buckets by developer or app using the Identifier element. But I can also specify a child Identifier/Class to provide more fine-grained quota setting/resetting. My questions are:

  • How do the parent Identifer and child Class interact or behave? (Or should I avoid this configuration?)
  • Is the Identifier name "_default" special in some way?

Thanks!

Solved Solved
3 6 854
2 ACCEPTED SOLUTIONS

Not applicable

Okay, looks like I answered the wrong question. I have not seen this usecase. But I would suspect the behavior would be something similar. i.e for each entity- set different limits for different classes.

But in that case, the Allow should be inside class, but in your example, it is outside. So I am not sure about it now!

View solution in original post

Not applicable

@Floyd,@sandeep, Looks like the above policy is wrong to reset the quota at class level , it doesn't even get saved and throws some schema exceptions .

View solution in original post

6 REPLIES 6

Not applicable

Hi @Floyd Jones,

  • Identifier element is how you identify the client. If you say its AppName or UserName, each App or User is treated as a different entity, and the quota rules are per each of the entity (for ex: each App will be allowed to access 100 requests per min. If you do not have identifier, then the quota will be blanket (ex: all Apps put together, will be allowed 100 requests per min
  • Allow element defines how much you allow per entity you have identified in the above step. This can be
    • A hardcoded value,
    • A variable you get from somewhere
    • A tiered/class based approach, allowing you to set different limits for different types of requests.

These are mutually exclusive. For example, if you have a policy like this: (with identifier as client_id and class as your time identifier

<Quota name="QuotaPolicy">
  <Interval>1</Interval>
  <TimeUnit>day</TimeUnit>
  <Allow count="100">
    <Class ref="time_variable">
      <Allow class="peak_time" count="1000"/>
      <Allow class="off_peak_time" count="10000" />
    </Class>
  </Allow>
  <Identifier ref="client_id"/>
</Quota>

What you are effectively saying is - for each app, allow it to use more api calls in the off peak hours. Might be helpful for APIs that you are launching as a trail.

Let me know if this helps

Thanks very much, Sandeep. I get all that, but the schema allows an Identifier > Class relationship, and we current have the following example in the Reset Quota docs, which was lifted from the original spec:

<Identifier name="_default">
   <Class ref="request.header.classIdentifier" />
   <Allow>200</Allow>
</Identifier>

This seems to let a policy use both an Identifier and a child Class. I was wondering in particular about the relationship between those two elements. Seems odd.

Not applicable

I do not know if _default means something different, but have tried to answer the other part of the question

Not applicable

Okay, looks like I answered the wrong question. I have not seen this usecase. But I would suspect the behavior would be something similar. i.e for each entity- set different limits for different classes.

But in that case, the Allow should be inside class, but in your example, it is outside. So I am not sure about it now!

Not applicable

@Floyd,@sandeep, Looks like the above policy is wrong to reset the quota at class level , it doesn't even get saved and throws some schema exceptions .

Thanks very much, guys. Much appreciated. I think it's enough for now to confirm that it's not right. I'll play around with it some more and file any appropriate bugs.