Skip to content

Commit 92df27d

Browse files
router: add request_body_buffer_limit for large request buffering (#40254)
## Description ML/inference requests often require buffering the entire request body to determine routing destination based on content rather than headers, and to support retries of failed requests. The existing `per_request_buffer_limit_bytes` (32-bit) is insufficient for large ML payloads that can exceed 4GB. This PR adds `request_body_buffer_limit` configuration to `VirtualHost` and `Route` for buffering large request bodies beyond connection buffer limits. This enables support for ML/inference workloads that require buffering entire request bodies for processing and retries. When `request_body_buffer_limit` is not configured, the existing `per_request_buffer_limit_bytes` behavior is preserved. Routes inherit from virtual hosts when not explicitly configured. See envoyproxy/envoy#40028 --- **Commit Message:** router: add request_body_buffer_limit for large request buffering **Additional Description:** Added `request_body_buffer_limit` configuration to `VirtualHost` and `Route` for buffering large request bodies beyond connection buffer limits. **Risk Level:** Low **Testing:** Added Unit + Integration Tests **Docs Changes:** Added **Release Notes:** Added --------- Signed-off-by: Rohit Agrawal <[email protected]> Signed-off-by: yanavlasov <[email protected]> Co-authored-by: yanavlasov <[email protected]> Mirrored from https://github.com/envoyproxy/envoy @ 369ace259ce3a67e16a1a29331671a533ffa6968
1 parent d05654c commit 92df27d

File tree

1 file changed

+60
-7
lines changed

1 file changed

+60
-7
lines changed

envoy/config/route/v3/route_components.proto

Lines changed: 60 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
4141
// host header. This allows a single listener to service multiple top level domain path trees. Once
4242
// a virtual host is selected based on the domain, the routes are processed in order to see which
4343
// upstream cluster to route to or whether to perform a redirect.
44-
// [#next-free-field: 25]
44+
// [#next-free-field: 26]
4545
message VirtualHost {
4646
option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.VirtualHost";
4747

@@ -205,10 +205,37 @@ message VirtualHost {
205205
// request header in retries initiated by per try timeouts.
206206
bool include_is_timeout_retry_header = 23;
207207

208-
// The maximum bytes which will be buffered for retries and shadowing.
209-
// If set and a route-specific limit is not set, the bytes actually buffered will be the minimum
210-
// value of this and the listener per_connection_buffer_limit_bytes.
211-
google.protobuf.UInt32Value per_request_buffer_limit_bytes = 18;
208+
// The maximum bytes which will be buffered for retries and shadowing. If set, the bytes actually buffered will be
209+
// the minimum value of this and the listener ``per_connection_buffer_limit_bytes``.
210+
//
211+
// .. attention::
212+
//
213+
// This field has been deprecated. Please use :ref:`request_body_buffer_limit
214+
// <envoy_v3_api_field_config.route.v3.VirtualHost.request_body_buffer_limit>` instead.
215+
// Only one of ``per_request_buffer_limit_bytes`` and ``request_body_buffer_limit`` could be set.
216+
google.protobuf.UInt32Value per_request_buffer_limit_bytes = 18
217+
[deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"];
218+
219+
// The maximum bytes which will be buffered for request bodies to support large request body
220+
// buffering beyond the ``per_connection_buffer_limit_bytes``.
221+
//
222+
// This limit is specifically for the request body buffering and allows buffering larger payloads while maintaining
223+
// flow control.
224+
//
225+
// Buffer limit precedence (from highest to lowest priority):
226+
//
227+
// 1. If ``request_body_buffer_limit`` is set, then ``request_body_buffer_limit`` will be used.
228+
// 2. If :ref:`per_request_buffer_limit_bytes <envoy_v3_api_field_config.route.v3.VirtualHost.per_request_buffer_limit_bytes>`
229+
// is set but ``request_body_buffer_limit`` is not, then ``min(per_request_buffer_limit_bytes, per_connection_buffer_limit_bytes)``
230+
// will be used.
231+
// 3. If neither is set, then ``per_connection_buffer_limit_bytes`` will be used.
232+
//
233+
// For flow control chunk sizes, ``min(per_connection_buffer_limit_bytes, 16KB)`` will be used.
234+
//
235+
// Only one of :ref:`per_request_buffer_limit_bytes <envoy_v3_api_field_config.route.v3.VirtualHost.per_request_buffer_limit_bytes>`
236+
// and ``request_body_buffer_limit`` could be set.
237+
google.protobuf.UInt64Value request_body_buffer_limit = 25
238+
[(validate.rules).message = {required: false}];
212239

213240
// Specify a set of default request mirroring policies for every route under this virtual host.
214241
// It takes precedence over the route config mirror policy entirely.
@@ -244,7 +271,7 @@ message RouteList {
244271
//
245272
// Envoy supports routing on HTTP method via :ref:`header matching
246273
// <envoy_v3_api_msg_config.route.v3.HeaderMatcher>`.
247-
// [#next-free-field: 20]
274+
// [#next-free-field: 21]
248275
message Route {
249276
option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.route.Route";
250277

@@ -341,7 +368,14 @@ message Route {
341368
// The maximum bytes which will be buffered for retries and shadowing.
342369
// If set, the bytes actually buffered will be the minimum value of this and the
343370
// listener per_connection_buffer_limit_bytes.
344-
google.protobuf.UInt32Value per_request_buffer_limit_bytes = 16;
371+
//
372+
// .. attention::
373+
//
374+
// This field has been deprecated. Please use :ref:`request_body_buffer_limit
375+
// <envoy_v3_api_field_config.route.v3.Route.request_body_buffer_limit>` instead.
376+
// Only one of ``per_request_buffer_limit_bytes`` and ``request_body_buffer_limit`` may be set.
377+
google.protobuf.UInt32Value per_request_buffer_limit_bytes = 16
378+
[deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"];
345379

346380
// The human readable prefix to use when emitting statistics for this endpoint.
347381
// The statistics are rooted at vhost.<virtual host name>.route.<stat_prefix>.
@@ -357,6 +391,25 @@ message Route {
357391
// every application endpoint. This is both not easily maintainable and
358392
// statistics use a non-trivial amount of memory(approximately 1KiB per route).
359393
string stat_prefix = 19;
394+
395+
// The maximum bytes which will be buffered for request bodies to support large request body
396+
// buffering beyond the ``per_connection_buffer_limit_bytes``.
397+
//
398+
// This limit is specifically for the request body buffering and allows buffering larger payloads while maintaining
399+
// flow control.
400+
//
401+
// Buffer limit precedence (from highest to lowest priority):
402+
//
403+
// 1. If ``request_body_buffer_limit`` is set: use ``request_body_buffer_limit``
404+
// 2. If :ref:`per_request_buffer_limit_bytes <envoy_v3_api_field_config.route.v3.Route.per_request_buffer_limit_bytes>`
405+
// is set but ``request_body_buffer_limit`` is not: use ``min(per_request_buffer_limit_bytes, per_connection_buffer_limit_bytes)``
406+
// 3. If neither is set: use ``per_connection_buffer_limit_bytes``
407+
//
408+
// For flow control chunk sizes, use ``min(per_connection_buffer_limit_bytes, 16KB)``.
409+
//
410+
// Only one of :ref:`per_request_buffer_limit_bytes <envoy_v3_api_field_config.route.v3.Route.per_request_buffer_limit_bytes>`
411+
// and ``request_body_buffer_limit`` may be set.
412+
google.protobuf.UInt64Value request_body_buffer_limit = 20;
360413
}
361414

362415
// Compared to the :ref:`cluster <envoy_v3_api_field_config.route.v3.RouteAction.cluster>` field that specifies a

0 commit comments

Comments
 (0)