Internal Limits
The internal_limits
section is designed to set more specific constraints within the main quota by defining nested intenal limits that inherit from the main parent quota. Each internal limit can have its own filters and strategies, enabling precise control over distinct user groups or endpoints.
ποΈ Internal Limits with Spillover
Internal limits provide a way to specify nested quotas within a primary quota, allowing granular control over specific groups or endpoints under the same overall quota. These limits can have individual strategies (such as fixed window or concurrent) and, where relevant, incorporate spillover settings.
ποΈ Internal Limits With Allocation Percentage
The allocation_percentage field allows users to allocate a specific percentage of a main quota to different internal quotas, ensuring more flexible and precise control over quota usage among different user groups or environments.
Quota Exampleβ
Hereβs an example of a quota configuration defined in a quota.yaml
file. In this example we see that api.website.com/*
has a quota, MyQuota
of 2000 requests per day. Part of this quota are the Production
, Team1
and Team2
limits which allow only 50 requests each per minute.
quotas:
- id: MyQuota
filter:
url: api.website.com/*
strategy:
fixed_window:
max: 20000
interval: 1
interval_unit: day
internal_limits:
- id: Production
parent_id: MyQuota
strategy:
fixed_window:
max: 50
interval: 1
interval_unit: minute
- id: Team1
parent_id: MyQuota
strategy:
fixed_window:
max: 50
interval: 1
interval_unit: minute
- id: Team2
parent_id: MyQuota
strategy:
fixed_window:
max: 50
interval: 1
interval_unit: minute