Spike Arrest retry time to be calculated to convey user

Hi,

I have a query related to spike arrest policy.

If the spike arrest policy is violated i.e, we have exceeded the rate limit then i need to convey the end user when to retry again so that the request is successfully submitted.

For ex; if the rate limit is 600 pm then it means that we can hit 10 requests in one sec (10 requests/sec) and suppose i have made all 10 requests in the first 500ms then i need to convey to the user to retry after 1000-500=500 ms .

Please help me out.

0 1 307
1 REPLY 1

Spike Arrest policy doesn't work this way. The throttling is at a global level, not specific to a user. It protects the proxy and target server from sudden surges in traffic.

Edit - It is possible to set the client_id as the <Identifier> in a spike arrest, but we don't provide running counts for that Identifier.

I think what you need is Quota policy. With Quota, it will provide flow variables which you can use to return HTTP headers to the API client indicating when the Quota window resets.

https://docs.apigee.com/api-platform/reference/policies/quota-policy#variables