You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: draft-ietf-httpapi-ratelimit-headers.md
+20-14Lines changed: 20 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ Currently, there is no standard way for servers to communicate quotas so that cl
71
71
- RateLimit-Policy: a quota policy, defined by the server, that client HTTP requests will consume.
72
72
- RateLimit: the currently remaining quota available for a specific policy.
73
73
74
-
These fields enable establishing complex rate limiting policies, including using multiple and variable time windows and dynamic quotas, and implementing concurrency limits.
74
+
These fields enable publishing complex rate limiting policies, including using multiple and variable time windows and dynamic quotas, and implementing concurrency limits.
75
75
76
76
## Goals {#goals}
77
77
@@ -106,6 +106,8 @@ The following features are out of the scope of this document:
106
106
107
107
The term Origin is to be interpreted as described in {{Section 7 of WEB-ORIGIN}}.
108
108
109
+
The terms "request", "response", "server", "client" are from {{HTTP}}.
110
+
109
111
This document uses the terms List, Item and Integer from {{Section 3 of SF}} to specify syntax and parsing, along with the concept of "bare item".
110
112
111
113
The term "problem type" in this document is to be interpreted as described in [PROBLEM].
@@ -125,11 +127,12 @@ The term "problem type" in this document is to be interpreted as described in [P
125
127
: A time window indicates a period of time associated to the allocated quota.
126
128
127
129
Quota Policy:
128
-
: A quota policy is implemented by the server to regulate the activity within a specified quota partition, quantified in quota units, over a defined time window. This activity is restricted to a predefined limit, known as the quota. Quota policies can be advertised by servers, but they are not required to be, and more than one quota policy can affect a given request from a client to a server.
130
+
: A quota policy is implemented by the server to regulate the activity within a specified quota partition, quantified in quota units, over a defined time window. This activity is restricted to a predefined limit, known as the quota. Quota policies MAY be advertised by servers; each request can be subject to more than one quota policy.
129
131
130
132
Service Limit:
131
133
: A service limit is the currently remaining quota from a specific quota policy and, if defined, the remaining time before quota is reallocated.
132
134
135
+
<!-- Duplicated from notational conventions. -->
133
136
List:
134
137
: A {{SF}} list of Items
135
138
@@ -140,9 +143,9 @@ The term "problem type" in this document is to be interpreted as described in [P
140
143
141
144
The "RateLimit-Policy" response header field is a non-empty List{{SF}} of Quota Policy Items ({{quotapolicy-item}}). The Item{{SF}} value MUST be a String{{SF}}.
142
145
143
-
The field value SHOULD remain consistent over a sequence of HTTP responses. It is this characteristic that differentiates it from the [RateLimit](#ratelimit-field) field that contains information that MAY change on every request. The "RateLimit-Policy" field enables clients to control their own flow of requests based on policy information provided by the server. Situations where throttling constraints are highly dynamic are better served using the [RateLimit field](#ratelimit-field) that communicates the latest service information a client can react to. Both fields can be communicated by the server when appropriate.
146
+
The field value SHOULD remain consistent over a sequence of responses. It is this characteristic that differentiates it from the [RateLimit](#ratelimit-field) field that contains information that MAY change on every request. The "RateLimit-Policy" field enables clients to control their own flow of requests based on policy information provided by the server. Situations where throttling constraints are highly dynamic are better served using the [RateLimit field](#ratelimit-field) that communicates the latest service information a client can react to. Both fields can be communicated by the server when appropriate.
144
147
145
-
Lists of Quota Policy Items ({{quotapolicy-item}}) can be split over multiple "RateLimit-Policy" fields in the same HTTP response as described in {{Section 3.1 of SF}}.
148
+
Lists of Quota Policy Items ({{quotapolicy-item}}) can be split over multiple "RateLimit-Policy" fields in the same response as described in {{Section 3.1 of SF}}.
@@ -155,16 +158,16 @@ A quota policy Item contains an identifier for the policy and a set of Parameter
155
158
The following parameters are defined:
156
159
157
160
q:
158
-
: The REQUIRED "q" parameter indicates the quota allocated by this policy measured in quota units.
161
+
: This REQUIRED parameter value indicates the quota allocated by this policy measured in quota units.
159
162
160
163
qu:
161
-
: The OPTIONAL "qu" parameter value conveys the quota units associated to the "q" parameter. The default quota unit is "requests".
164
+
: This OPTIONAL parameter value conveys the quota units associated to the "q" parameter. The default quota unit is "requests".
162
165
163
166
w:
164
-
: The OPTIONAL "w" parameter value conveys a time window.
167
+
: This OPTIONAL parameter value conveys a time window.
165
168
166
169
pk:
167
-
: The OPTIONAL "pk" parameter value conveys the partition key associated to the corresponding request.
170
+
: This OPTIONAL parameter value conveys the partition key associated to the corresponding request.
168
171
169
172
Other parameters are allowed and can be regarded as comments.
170
173
@@ -174,7 +177,7 @@ This field MUST NOT appear in a trailer section.
174
177
175
178
### Quota Parameter {#ratelimitpolicy-quota}
176
179
177
-
The "q" parameter value MUST be a non-negative Integer. The value indicates the quota allocated for client activity (measured in quota units) for a given quota partition.
180
+
The "q" parameter value MUST be a non-negative Integer. The value indicates the quota allocated for client activity (measured in quota units) for a given quota partition.
178
181
179
182
### Quota Unit Parameter {#ratelimitpolicy-quotaunit}
180
183
@@ -191,7 +194,7 @@ The "qu" parameter value conveys the quota units applicable to the quota ({{rate
191
194
192
195
### Window Parameter {#ratelimitpolicy-window}
193
196
194
-
The "w" parameter value conveys a time window applicable to the quota ({{ratelimitpolicy-quota}}). The time window MUST be a non-negative, non-zero, Integer value expressing an interval in seconds, similar to the "delay-seconds" rule defined in {{Section 10.2.3 of HTTP}}. Sub-second precision is not supported.
197
+
The "w" parameter value conveys a time window applicable to the quota ({{ratelimitpolicy-quota}}). The time window MUST be a positive Integer value expressing an interval in seconds, similar to the "delay-seconds" rule defined in {{Section 10.2.3 of HTTP}}. Sub-second precision is not supported.
@@ -245,10 +248,10 @@ The following parameters are defined in this specification:
245
248
: This REQUIRED parameter value conveys the remaining quota units for the identified policy ({{ratelimit-remaining-parameter}}).
246
249
247
250
t:
248
-
: This OPTIONAL parameter value conveys the time until additional quota is made available for the identified policy ({{ratelimit-reset-parameter}}).
251
+
: This OPTIONAL parameter value conveys the time interval until additional quota is made available for the identified policy ({{ratelimit-reset-parameter}}).
249
252
250
253
pk:
251
-
: The OPTIONAL "pk" parameter value conveys the partition key associated to the corresponding request.
254
+
: This OPTIONAL parameter value conveys the partition key associated to the corresponding request.
252
255
253
256
This field MUST NOT appear in a trailer section. Other parameters are allowed and can be regarded as comments.
254
257
@@ -369,7 +372,8 @@ Under certain conditions, a server MAY artificially lower RateLimit header field
369
372
370
373
## Generating Partition Keys
371
374
372
-
Servers MAY choose to return partition keys that distinguish between quota allocated to different consumers or different resources. There are a wide range of strategies for partitioning server capacity, including per user, per application, per HTTP method, per resource, or some combination of those values. The server SHOULD document how the partition key is generated so that clients can predict the key value for a future request and determine if there is sufficient quota remaining to execute the request. Servers should avoid returning partition keys that contain sensitive information. Servers SHOULD only use information that is present in the request to generate the partition key.
375
+
Servers MAY choose to return partition keys that distinguish between quota allocated to different consumers or different resources. There are a wide range of strategies for partitioning server capacity, including per user, per application, per HTTP method, per resource, or some combination of those values. The server SHOULD document how the partition key is generated so that clients can predict the key value for a future request and determine if there is sufficient quota remaining to execute the request. Servers should avoid returning partition keys that contain sensitive information.
376
+
Servers SHOULD only use information that is present in the request to generate the partition key. <!-- Maybe SHOULD use opaque pk? -->
373
377
374
378
## Performance Considerations
375
379
@@ -417,7 +421,9 @@ Partition keys are useful for a client if it is likely that single client will m
417
421
418
422
If a server documents the partition key generation algorithm, clients MAY generate a partition key for a future request. Using this key, and comparing to the key returned by the server, the client can determine if there is sufficient quota remaining to execute the request.
419
423
420
-
For cases where the partition key generation algorithm of a server is unknown, clients MAY use heuristics to guess if a future request will be successful based on its similarity to previous requests.
424
+
When the partition key generation algorithm is unknown, clients MAY use heuristics to guess if a future request will be successful based on its similarity to previous requests.
425
+
426
+
<!-- The above text seems to suggest a protocol... -->
0 commit comments