How does the quota plugin work under the hood?

Not applicable

The concept of a hybrid API management with federated policy enforcement points (=EMG) combined with a central management solution (=Edge) is quite interesting for us given our multi-cloud microservices environment.One of the use cases is to run the same service/capability in different locations while using federated EMG's which are co-located with the service instances

That would imply that the quota plugin needs to support federation/distribution as well as to making policy decisions based on the aggregate number of incoming requests across all EMG's. The documentation for the EMG quota plugin mentions "distributed counters".

Can anyone shed some light onto how these "distributed counters" are actually implemented technically given that apparently, there is no database backend involved ?

thanks, Nick

0 2 276
2 REPLIES 2

Former Community Member
Not applicable

@Nick Laqua, You are correct, EM does not have a local storage. It contacts Edge for this information. EM uses the Apigee volos-quota-plugin (see here for more details: https://www.npmjs.com/package/volos-quota-apigee).

This plugin periodically (async) calls Edge to both send the local usage counter (so that Edge can update it centrally) as well as get the "quota remaining" from Edge so that it can enforce quota locally.

Hello @Nick Laqua

Adding to what @Srinandan Sridhar stated.

EM relies on Edge for the distributed quota to function correctly. For each request, EM asynchronously POSTs a request to Edge to update the distributed counter. The response from the POST request is the allowed is shown below.

apigee Quota result: {"allowed":5,"used":2,"exceeded":0,"available":3,"expiryTime":20628,"timestamp":1486494917583}

The quota policy in Edge uses flexi type and that means that the counter starts when the first request is received and resets based on the interval and time unit. The identifier for the counter is the org name plus the application name.