When you receive error code 429 from Impala APIs, it means you have hit the API Rate Limits for requests. This means you have made a higher number of API requests than we allow by default in a small period of time (20 requests per minute). When this happens Impala API stops processing any more requests until the minute has passed.
This article covers the following best practices for handling rate limiting.
Optimize your Request Logic
- Evaluate if there is a cache you could implement on your end. This would increase the performance and reduce the need for higher concurrency from Impala. E.g., cache the hotel lists at the beginning of the day instead of calling /hotels endpoint for every page render. NOTE: Prices will change over time, it is important that before making a booking that fresh prices are retrieved to make sure they are still valid
- Evaluate if a larger page size can be used within acceptable response times. E.g., fetch 25 hotels instead of 10. This will reduce the number of requests to 1/5th from, with a slightly higher response time.
Retry with Exponential Backoff
You can be confident that the API Request that received error 429 response was never processed by Impala and is always safe to retry. Please wait for a short period of time and make the request again, or alter your client's settings to issue fewer concurrent requests in the first place.
When implementing retries, instead of retrying after waiting for a fixed amount of time, we increase the waiting time between retries after each retry failure. This method is called Exponential Backoff.
The following pseudo code shows one of the ways to implement your requests using the incremental delay.
Contact us if you think you have a valid case for higher rate limits.
If you have already implemented the recommended approaches, and still get 429 indicating a valid reason for the higher rate limit, drop us a note at firstname.lastname@example.org explaining your use case in detail.