From ed87422da6e3b8f8eaff8268f2ccd8c0cf881b6b Mon Sep 17 00:00:00 2001 From: "data-plane-api(Azure Pipelines)" Date: Fri, 24 Mar 2023 04:20:48 +0000 Subject: [PATCH] Adding a new API for ext_proc server to stop the original timer and start a new timer (#25802) This can help ext_proc server to extend the timeout value in case it needs more time to process a request in special situations like cold start a WASM module when receives the first request. Risk level: Low Testing: Integration tests. Signed-off-by: Yanjun Xiang Mirrored from https://github.com/envoyproxy/envoy @ f23c23e24264bfe0bf9453a071ec7040f79dc347 --- .../filters/http/ext_proc/v3/ext_proc.proto | 7 ++++++- .../ext_proc/v3/external_processor.proto | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/envoy/extensions/filters/http/ext_proc/v3/ext_proc.proto b/envoy/extensions/filters/http/ext_proc/v3/ext_proc.proto index 65a8a3f1..e4b5b695 100644 --- a/envoy/extensions/filters/http/ext_proc/v3/ext_proc.proto +++ b/envoy/extensions/filters/http/ext_proc/v3/ext_proc.proto @@ -95,7 +95,7 @@ option (xds.annotations.v3.file_status).work_in_progress = true; // messages, and the server must reply with // :ref:`ProcessingResponse `. -// [#next-free-field: 10] +// [#next-free-field: 11] message ExternalProcessor { // Configuration for the gRPC service that the filter will communicate with. // The filter supports both the "Envoy" and "Google" gRPC clients. @@ -163,6 +163,11 @@ message ExternalProcessor { // :ref:`clear_route_cache ` // field to true in the same response. config.common.mutation_rules.v3.HeaderMutationRules mutation_rules = 9; + + // Specify the upper bound of + // :ref:`override_message_timeout ` + // If not specified, by default it is 0, which will effectively disable the ``override_message_timeout`` API. + google.protobuf.Duration max_message_timeout = 10; } // Extra settings that may be added to per-route configuration for a diff --git a/envoy/service/ext_proc/v3/external_processor.proto b/envoy/service/ext_proc/v3/external_processor.proto index 044f842a..9d09828e 100644 --- a/envoy/service/ext_proc/v3/external_processor.proto +++ b/envoy/service/ext_proc/v3/external_processor.proto @@ -6,6 +6,7 @@ import "envoy/config/core/v3/base.proto"; import "envoy/extensions/filters/http/ext_proc/v3/processing_mode.proto"; import "envoy/type/v3/http_status.proto"; +import "google/protobuf/duration.proto"; import "google/protobuf/struct.proto"; import "xds/annotations/v3/status.proto"; @@ -121,7 +122,7 @@ message ProcessingRequest { // For every ProcessingRequest received by the server with the ``async_mode`` field // set to false, the server must send back exactly one ProcessingResponse message. -// [#next-free-field: 10] +// [#next-free-field: 11] message ProcessingResponse { oneof response { option (validate.required) = true; @@ -170,6 +171,21 @@ message ProcessingResponse { // may use this to intelligently control how requests are processed // based on the headers and other metadata that they see. envoy.extensions.filters.http.ext_proc.v3.ProcessingMode mode_override = 9; + + // When ext_proc server receives a request message, in case it needs more + // time to process the message, it sends back a ProcessingResponse message + // with a new timeout value. When Envoy receives this response message, + // it ignores other fields in the response, just stop the original timer, + // which has the timeout value specified in + // :ref:`message_timeout + // ` + // and start a new timer with this ``override_message_timeout`` value and keep the + // Envoy ext_proc filter state machine intact. + // Has to be >= 1ms and <= + // :ref:`max_message_timeout ` + // Such message can be sent at most once in a particular Envoy ext_proc filter processing state. + // To enable this API, one has to set ``max_message_timeout`` to a number >= 1ms. + google.protobuf.Duration override_message_timeout = 10; } // The following are messages that are sent to the server.