---
title: Rate limiting
summary: >-
  Fastly can ensure everyone gets a great experience even during massive traffic
  surges.
url: https://www.fastly.com/documentation/solutions/use-cases/rate-limiting
---


import SolutionsProvider from '~providers/solutions'
import SolutionsTable from '~components/solutions-table/solutions-table'

<p class="lead">Avoid being overwhelmed. Fastly's network can handle hundreds of terabits of traffic per second, so whether it's managing a queue for a product or ticket release, preventing abusive traffic from bots, or billing API customers based on their usage, rate limiting at the edge is a great use of Fastly.</p>

![Virtual waiting room](/img/rate-limiting-hero.png)

## Fastly features

Our dedicated [Edge Rate Limiting](/guides/concepts/rate-limiting) product provides [`ratecounter`](/reference/vcl/declarations/ratecounter/) and [`penaltybox`](/reference/vcl/declarations/penaltybox/) primitives to [VCL](/guides/full-site-delivery/fastly-vcl) and [Compute](/guides/compute/) services. [Real time logging](/guides/integrations/non-fastly-services/developer-guide-logging) allows data from the edge to be streamed to a destination of your choice, which is often useful for counting specific types of request.

Granular counters are also included with [Advanced Rate Limiting rules](https://docs.fastly.com/signalsciences/using-signal-sciences/rules/working-with-advanced-rate-limiting-rules/) in our Next-Gen WAF.

> **HINT:** Compute customers can find equivalent functions in [Compute SDKs](/reference/compute/sdks/).

## Ideas and typical uses

Typically, rate limiting requests at the edge broadly falls into one of three use cases:

* **Abuse prevention:** stopping abusive bots that may be badly configured, malfunctioning or intentionally attempting to bring down your site in a denial-of-service attack. This is a great use of [Edge Rate Limiting](/guides/concepts/rate-limiting).
* **Metering**: Accurately measuring activity for billing or subscription purposes, with a cutoff when a prescribed volume is reached. Consider using [Real time logging](/guides/integrations/non-fastly-services/developer-guide-logging) in combination with an aggregation or business intelligence tool outside of Fastly to receive and process the data.
* **Queueing:** Flattening the curve of traffic surges caused by product releases or sudden major publicity. The [Compute](/guides/compute) platform, combined with a state store capable of atomic incrementing counters is a good way to create queueing solutions at the edge, or alternatively consider a stateless waiting room solution if strict queue order is not important.

## Solutions

<SolutionsProvider useCase='rate-limiting' render={(nodes) => (
  <SolutionsTable nodes={nodes} />
)} />

## Blogs and articles

- [Queues and waiting rooms aren't that hard](https://dev.to/fastly/queues-and-waiting-rooms-arent-that-hard-4e39)
- [Integrating Queue-it with Fastly](https://queue-it.com/fastly-cdn/)
- [Put grinch bots in the penalty box with enriched security data and our edge cloud platform](https://www.fastly.com/blog/put-grinch-bots-in-the-penalty-box-with-security-data-and-our-edge-cloud)
