Загрузка...

API rate limiting, interview question and answer #fyp #explore #techlearn #trending #viral

Answer - example of insurance industry, where I am working….
1️⃣ First say the problem
In our insurance purchase product, users request APIs like:
* Generate OTP
* Check premium
* Buy policy
* Payment verification
If someone keeps hitting these APIs continuously, it can:
* overload the system
* cause OTP spam
* slow down purchase flow for other users
So we implemented rate limiting.

2️⃣ How we implemented it
We restricted how many requests a user can make in a time window.
Example rule:
API Limit
Generate OTP 5 requests per 10 minutes
Premium calculation 50 requests per minute
Purchase policy 10 requests per minute
If the user crosses the limit → API returns

HTTP 429 : Too Many Requests

3️⃣ Internal working
When request comes:
1️⃣ API receives request�2️⃣ System checks how many requests this user/IP already made�3️⃣ Count is stored in Redis cache�4️⃣ If limit not exceeded → request is processed�5️⃣ If limit exceeded → return 429 error

4️⃣ One interview answer
You can say this:
In our insurance purchase system we implemented rate limiting to prevent abuse of APIs like OTP generation and premium calculation. We configured limits per user/IP for a fixed time window. We stored request counters in Redis and if the user exceeded the limit, the system returned HTTP 429 Too Many Requests. This helped protect our APIs from spam and system overload.

5️⃣ Example Implementation (Spring Boot + Bucket4j)
A very common Java way.

6️⃣ Simple Flow
User Request

Rate Limit Filter

Check request count

If limit OK → Call API
If limit exceeded → 429 error
.
You can use example as per your project or any e-commerce project.
.
Follow for more such content
#fyp #explore #trending #viral #tech

Видео API rate limiting, interview question and answer #fyp #explore #techlearn #trending #viral канала Black Cask
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять