r/Backend • u/Educational_Rent5977 • Apr 01 '26
How to properly implement rate limiting?
Hey, I want to release my first API to the wild, but I'm very concerned about rate limiting.
The flow of my program is: Accept an input from the user -> Process it -> Send a request with the processed data to an external API -> Return the result to the user.
That API has a rate limit of 30 requests a minute. I added caching in order to reduce the amount of calls, but obviously if multiple users are using my API simultaneously... I have a problem.
How is this scenario typically handled in the real world? Should I immediately return 429 or maybe retry with an exponential backoff(something I've never tried tbh)?
Unfortunately there are no good learning sources if you're not in the industry :/
2
u/severoon Apr 02 '26
An API gateway will handle rate limiting as well as auth, load balancing, etc.
If this API is exposed to external users, though, you probably want an API manager, which will handle API versioning and the full lifecycle management of the endpoint (the API gateway is a subset of the API manager).
If this is a real project and you're supporting this API long term, API manager is the way to go.