Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Throttling API calls per second without smoothing logic

Hello everyone...

I have a specific requirement in terms of throttling API calls coming into apigee Edge public cloud.

  • Ability to throttle API traffic where I cannot allow more than 10 tps (Please note: Transactions per SECOND)
  • The 10 tps traffic SHOULD not be going thru the SMOOTHING logic as 10 tps is a valid traffic for our backend to handle.
    • This necessarily rules out the usage of Spike Arrest policy as the 10 tps configuration would smooth out and doesn't allow more than 1 call every 100 ms.
    • In my situation, our backend system can handle 10 calls at the same millisecond and it is a valid scenario for us to handle (Not considered as a Spike).
    • I have also looked ConcurrentRateLimitPolicy and apparently, it is logical that it doesn't serve my requirement.
  • I've looked at Quota policy which can simply act as a counter. But there are limitations where:

On a tail note, its kind of sad that apigee doesn't support this feature which has been available in IBM Datapower, WSO2, Axway API Gateway, etc. for a very long time.

Does anyone have any suggestions to solve this problem?

I'm ok to have a complex custom implementation too as I'm desperately looking for this feature. A critical deployment is just pending for this logic to be implemented. Would appreciate any guidance on this.

Thanks.

Solved Solved
1 7 3,724
1 ACCEPTED SOLUTION

Hi @Dinesh Palanivel,

You can indeed set Quota per second, please see docs here: https://docs.apigee.com/api-platform/reference/policies/quota-policy#timeunit

Perhaps they have been updated since your original post.

Also note, that using "second" means it cannot be distributed, so you'll have to account for the # of MPs you have. For example if you have 4 MPs, setting 3 TPS will yield an effective count of 12 TPS.

<Quota async="false" continueOnError="false" enabled="true" name="QU-BySecond">
    <DisplayName>QU-BySecond</DisplayName>
    <Allow countRef="request.header.quota_allow" count="3"/>
    <Interval ref="request.header.quota_interval">1</Interval>
    <TimeUnit ref="request.header.quota_timeunit">second</TimeUnit>
</Quota>

View solution in original post

7 REPLIES 7