From adf1c8bb2aa977a7184530345eb55bc5ad74bf84 Mon Sep 17 00:00:00 2001 From: Aleksander Borowski Date: Thu, 14 Mar 2024 09:57:45 +0100 Subject: [PATCH 1/2] doc: Update rate limiting docs to include providers --- doc/content/reference/rate-limiting/_index.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/content/reference/rate-limiting/_index.md b/doc/content/reference/rate-limiting/_index.md index 05710c1df4..cffe03508a 100644 --- a/doc/content/reference/rate-limiting/_index.md +++ b/doc/content/reference/rate-limiting/_index.md @@ -134,3 +134,19 @@ rate-limiting: associations: - gs:up ``` + +## Rate limiting providers + +The default rate limiting provider for {{% tts %}} is `memory`. When using this provider the state of rate limiting is stored locally on each instance. The drawback of using it is inconsistent rate limiting state. The `redis` provider eliminates this problem by storing a shared rate limiting state for all instances. + +| Provider | State | +| -------- | ------------ | +| `memory` | per instance | +| `redis` | shared | + +To enable `redis` rate limiting provider you can set it in rate limiting configuration. + +```yaml +rate-limiting: + provider: `redis` +``` From bc93dbbec409a7f7b39c04bf137b33cfd2471de9 Mon Sep 17 00:00:00 2001 From: Aleksander Borowski Date: Thu, 14 Mar 2024 09:58:38 +0100 Subject: [PATCH 2/2] doc: Remove duplicate example in rate limiting --- doc/content/reference/rate-limiting/_index.md | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/doc/content/reference/rate-limiting/_index.md b/doc/content/reference/rate-limiting/_index.md index cffe03508a..fd5bc5ad72 100644 --- a/doc/content/reference/rate-limiting/_index.md +++ b/doc/content/reference/rate-limiting/_index.md @@ -95,46 +95,6 @@ When rate limiting is enabled, the following headers are added to all HTTP and g - `X-Rate-Limit-Reset`: Seconds until the rate limiter resets. - `X-Rate-Limit-Retry`: Seconds the client should wait before retrying the request. -## Example configuration - -Enable rate limiting by adding the following configuration to your `ttn-lw-stack.yml`. Make sure to alter the values accordingly so that they match your deployment needs. - -```yaml -rate-limiting: - profiles: - - name: HTTP servers - max-per-min: 30 - associations: - - http - - name: Application downlink traffic - max-per-min: 10 - associations: - - as:down:web - - as:down:mqtt - - grpc:method:/ttn.v3.lorawan.v3.AppAs/DownlinkQueuePush - - grpc:method:/ttn.v3.lorawan.v3.AppAs/DownlinkQueueReplace - - name: Gateway connections - max-per-min: 5 - associations: - - gs:accept:mqtt - - gs:accept:ws - - grpc:stream:accept:/ttn.lorawan.v3.GtwGs/LinkGateway - - name: gRPC API - max-per-min: 60 - associations: - - grpc:method - - grpc:stream:accept - - name: Override rate for uplink simulation - max-per-min: 5 - associations: - - grpc:method:/ttn.lorawan.v3.AppAs/SimulateUplink - - name: Gateway uplink traffic - max-per-min: 1000 - max-burst: 1500 - associations: - - gs:up -``` - ## Rate limiting providers The default rate limiting provider for {{% tts %}} is `memory`. When using this provider the state of rate limiting is stored locally on each instance. The drawback of using it is inconsistent rate limiting state. The `redis` provider eliminates this problem by storing a shared rate limiting state for all instances.