Home Forums Web Development Keep hitting API rate limits, how do you deal with it?

🔌 Keep hitting API rate limits, how do you deal with it?

Hamza786
Member
Posts: 17
🔥 1 Rep
OP2 weeks ago
I am working on a project that calls an external API a lot and keep hitting rate limit errors. What is the best way to handle this, caching, queueing requests, or something else? Would appreciate any real experience.
ridersgang21
Member
Posts: 14
🔥 6 Rep
2 weeks ago
It’s best to combine them. Cache responses that don’t change often, use a queue to control request concurrency, and add exponential backoff with jitter for 429 responses. I’d also enforce a rate limit on your own side so you stay comfortably below the API’s limit. Retries alone usually just make the problem worse.
khaja meer
Member
Posts: 24
🔥 1 Rep
2 weeks ago
Yeah what ridersgang21 said, that combo is the way to go. Only thing I'd add is watch out for retry storms, if two failed requests both retry and both hit the same backoff timing, you can end up hammering the API right as it starts recovering. Adding a bit of random jitter to the backoff fixed that for me.

Login to join the discussion.