# Explain how a rate limiter works.

Aced (formerly Exponent) publishes a public search API over its indexed pages; the guide is at https://www.aced.io/agents/agent-access.

Source: https://www.aced.io/questions/7418/explain-rate-limiter-works
Source observed: 2026-11-04T21:22:55.706Z
Last checked: 2026-11-04T21:22:55.706+00:00
Indexed: 2026-11-04T23:47:45.99+00:00

---

# Explain how a rate limiter works.

We publish this as a **Concept** and **System Design** interview question for **Software Engineer** candidates. The page reports **1 interview**, associated with **Okta**, and an interview experience shared **a month ago**.

## Interview experience

[Okta software-engineer interview experience](https://www.aced.io/experiences/okta-software-engineer-interview-767879)

The shared experience describes a lengthy process in which the recruiter stayed in contact and provided preparation information; the interviewers were described as good and polite. The role was **Software Engineer · Mid Level / L4**.

## Community answers

There are **4 community answers**.

### Definition and basic operation

A rate limiter is a software component that controls the frequency and volume of incoming or outgoing traffic to a network, API, or service. It identifies the requester, checks a quota or counter for the active time period, applies a policy, and either allows, queues, or rejects the request.

Rate limiting helps:

- Prevent services from being overwhelmed.
- Control infrastructure and API costs.
- Reduce denial-of-service, spam, and brute-force abuse.
- Prevent resource starvation and provide fair allocation across users or tenants.

### How a request is handled

1. **Identify the client.** Use an IP address, API key, application key, user ID, authorization token, or JWT identity.
2. **Look up the counter or quota.** Check the requester’s current count or remaining budget in the active time window.
3. **Evaluate the policy.** If the request is within the limit, pass it to the service and increment usage. If the limit is exceeded, reject it, return a retry indication, or queue it, depending on the design.
4. **Reset or replenish.** When the window expires, reset the counter or replenish the available budget.

A separate rate-limiting service can perform this check at the time of the request. A caching layer may be needed for fast checks, depending on the algorithm. Limits may be configured centrally and cached for efficient access.

### Core algorithms

#### Token bucket

Tokens are added at a fixed rate `r` to a bucket with capacity `b`. Each request consumes one token. When no tokens remain, the request is dropped. This supports bursts up to the bucket capacity.

#### Leaky bucket

Requests enter a FIFO queue and are processed at a constant rate. If the queue overflows, new requests are discarded. This smooths traffic spikes into a steady flow.

#### Fixed-window counter

Time is divided into fixed windows and requests are counted in each window. It is simple to implement, but can permit up to twice the nominal rate around a window boundary.

For example, a policy might allow **60 requests in 1 minute**.

#### Sliding-window log

Store the exact timestamp of each request and remove timestamps older than the window length. This is precise but uses more memory.

#### Sliding-window counter

Combine the current and previous fixed-window counters using a weighted average based on the current position in the window. This is more memory-efficient and reduces boundary bursts.

### Client-identification choices

- **IP address:** Useful for unauthenticated endpoints, but shared NAT or VPN addresses can affect multiple users.
- **API key:** Identifies a registered API client or application through a header or query parameter.
- **User ID or JWT:** Identifies an authenticated user from decoded JWT claims or session state.

At Layer 7 for HTTP requests, limits commonly use user identity or a service-wide quota. At Layer 3, the client IP is more central. IP-based controls can be unreliable in some environments, so managed protection may be needed for network-level denial-of-service threats.

### HTTP response signaling

- **`429 Too Many Requests`:** Standard response status when the limit is exceeded.
- **`X-Ratelimit-Remaining`:** Number of permitted requests remaining in the current window.
- **`X-Ratelimit-Reset`:** Unix timestamp or number of seconds until the limit resets.

### Client-side behavior

The primary protection should operate on the service side. Client-side checks can still improve user experience and avoid requests that are certain to fail—for example, preventing submission when required form fields are incomplete—rather than sending the request only to have the server reject it.

## Related questions

- [Explain how RAG works.](https://www.aced.io/questions/5877/explain-rag)
- [Design a rate limiter.](https://www.aced.io/questions/2703/design-rate-limiter)
- [Explain how hash maps work.](https://www.aced.io/questions/4209/how-hash-map-works)

## Related courses

### [Software Engineering Interview Prep](https://www.aced.io/courses/software-engineering)

![Software Engineering Interview Prep](https://images.ctfassets.net/x78yjrjc11pq/4VkuYewBHUFIVUS5oJDW5h/02e833439b1289f25f38f13f81cbdca3/adobe_stock_optimized.jpeg?w=800&h=800&fm=webp&q=75)

Prepare for software-engineering roles at Google, Amazon, Microsoft, Meta, Apple, and other companies with practice in data structures, algorithms, system design, people management, behavioral interviews, and more.

### [System Design Interviews](https://www.aced.io/courses/system-design-interviews)

![System Design Interviews](https://images.ctfassets.net/x78yjrjc11pq/78x7miFZFjBCrM5GqftrMJ/2f6d26e632c4e7265c49f6a180227edb/system_design_track_compressed_26ac98a46e__281_29_5be2280f31.jpeg?w=800&h=800&fm=webp&q=75)

Learn to answer system-design questions across product, infrastructure, and AI domains through video examples, written breakdowns, reference patterns, and mock-interview answers from senior engineers and managers.

---

[Read this page’s summary](https://www.aced.io/agents/api/public/v1/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F7418%2Fexplain-rate-limiter-works&trace=t_679ff9ab98f3)

## Ask a follow-up about this page

Need a more specific answer? Ask the exact question you have. It returns a fresh, cited answer from Aced (formerly Exponent)’s knowledge base. No account or API key required.

Open this URL with your own question, URL-encoded. Include your question in q. All research inputs are optional; no account or setup.

`GET https://www.aced.io/agents/agent/faq?q={question}&trace=t_679ff9ab98f3`

[Tool guide and examples](https://www.aced.io/agents/agent-access) · [OpenAPI](https://www.aced.io/agents/api/public/v1/openapi.json) · [Page TLDR form](https://www.aced.io/agents/agent-tools/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F7418%2Fexplain-rate-limiter-works). Opening a form does not execute a tool.