Quota counters : what makes them distinct? Are there additional filters on top of the Identifier field?

StackOverflow https://stackoverflow.com/questions/21615609

  •  08-10-2022
  •  | 
  •  

Question

Say within an API bundle, we have 3 different flows (e.g., flow A, flow B, and flow C), and they all reference the same Quota policy named QuotaLimitPolicy. Are they really using separate counters for a given Identifier?

 Flow A is executed -> QuotaLimitPolicy is executed.  Result: "A counter" = 1
 Flow B is executed -> QuotaLimitPolicy is executed.  Result: "B counter" = 1
 Flow A is executed -> QuotaLimitPolicy is executed.  Result: "A counter" = 1 +1 = 2
 Flow C is executed -> QuotaLimitPolicy is executed.  Result: "C counter" = 1
 Flow A is executed -> QuotaLimitPolicy is executed.  Result: "A counter" = 2 +1 = 3

More generally, what makes a quota counter distinct in addition to the Identifier?

Was it helpful?

Solution

For instance, in the sample below in 1 API bundle, are there really 3 separate counters maintained?

Flow A is executed -> QuotaLimitPolicy is executed.  Result: "A counter" = 1
Flow B is executed -> QuotaLimitPolicy is executed.  Result: "B counter" = 1
Flow A is executed -> QuotaLimitPolicy is executed.  Result: "A counter" = 1 +1 = 2
Flow C is executed -> QuotaLimitPolicy is executed.  Result: "C counter" = 1
Flow A is executed -> QuotaLimitPolicy is executed.  Result: "A counter" = 2 +1 = 3

No, only 1 is maintained. Within a bundle, all references to the same policy use the same counter. In the example above, QuotaLimitPolicy is really a single counter for a given Identifier. So for a single Identifier (say, client_id = 10.10.10.10), the chain above would result in a single counter with a value of 5, one for each execution of QuotaLimitPolicy.

More generally, what makes a quota counter distinct in addition to the Identifier?

The distinction is at the policy name level per API bundle. If you want to create separate counters for various flows in the same bundle, you need to create separate policies with different "name=" attributes. Furthermore, I don't believe I can share a single quota counter across multiple API bundles for a given environment using the Quota policy.

These are not good or bad things, but rather, I'd like to bring awareness so that these are considered in solution designs.

OTHER TIPS

Furthermore, I don't believe I can share a single quota counter across multiple API bundles for a given environment using the Quota policy.

You should be able to share a Quota counter across API proxies by using Quotas along with API products. If you set the Quota policy to import settings from an API product, and you include API resources from two or more API proxies in the API product, then the counter should be shared across those two proxies.

See "Dynamic quota settings" here: http://apigee.com/docs/api-services/content/rate-limit-api-traffic-using-quota

Not sure if that is exactly what you are looking for, but hope that helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top