ext_proc: Implement STREAMED body processing mode#17069
ext_proc: Implement STREAMED body processing mode#17069htuch merged 15 commits intoenvoyproxy:mainfrom
Conversation
Signed-off-by: Gregory Brail <gregbrail@google.com>
Signed-off-by: Gregory Brail <gregbrail@google.com>
Signed-off-by: Gregory Brail <gregbrail@google.com>
Signed-off-by: Gregory Brail <gregbrail@google.com>
Signed-off-by: Gregory Brail <gregbrail@google.com>
Signed-off-by: Gregory Brail <gregbrail@google.com>
Signed-off-by: Gregory Brail <gregbrail@google.com>
htuch
left a comment
There was a problem hiding this comment.
Thanks, this is super cool.
/wait
|
@ikepolinsky would appreciate your take on this PR; since you will be writing the fuzzing against this, it's probably a good idea to make sure it's testable and matches your understanding. |
|
Thanks for your comments -- I have some improvements I'm working on but I have one test failure to address before they're ready. |
Clarify "streaming integration test" by using standard assert macros and with some comments. Fix bugs that happen when streamed message bodies are prematurely closed or have their processing mode changed. Reduce the amount of watermarking the filter does in streamed mode. Signed-off-by: Gregory Brail <gregbrail@google.com>
Signed-off-by: Gregory Brail <gregbrail@google.com>
Signed-off-by: Gregory Brail <gregbrail@google.com>
htuch
left a comment
There was a problem hiding this comment.
Sorry about the delay, holiday week.
/wait
Signed-off-by: Gregory Brail <gregbrail@google.com>
Signed-off-by: Gregory Brail <gregbrail@google.com>
Signed-off-by: Gregory Brail <gregbrail@google.com>
htuch
left a comment
There was a problem hiding this comment.
Thanks, this reads well to me now, the only two things before shipping are nits and maybe getting some better docs on the thread around HTTP filter chain resumption while chunks are out for processing.
test/extensions/filters/http/ext_proc/streaming_integration_test.cc
Outdated
Show resolved
Hide resolved
Signed-off-by: Gregory Brail <gregbrail@google.com>
Signed-off-by: Gregory Brail <gregbrail@google.com>
|
The original discussion about how to do this was covered in #16760 and with this PR, that issue can be closed. |
Implement this mode, which allows an external processor to receive the body one chunk at a time and examine or modify the body while it is being processed. Risk Level: Medium. The mode is only engaged if used. However an external processor must be coded carefully, particularly if it expects to stream both request and response bodies simultaneously, since each will proceed in its own ordering. Testing: New unit and integration tests. Docs Changes: Updated proto docs to reflect that the mode is now supported. Release Notes: External processing servers may now use the STREAMED processing mode. In this mode, chunks of the body are forwarded to the external processing server when they arrive. Depending on how the upstream system is implemented, request body chunks may be delivered before or after the response headers, and request and response body chunks may be interleaved if the upstream system delivers them that way. An external processor should be carefully coded so that it does not assume that a particular ordering will be implemented. Signed-off-by: Gregory Brail <gregbrail@google.com>
|
@gbrail do you have a working example of Streamed mode working I'm not able to make it work even on the most basic example... only on buffered mode |
|
Sure -- take a look at:
GoogleCloudPlatform/envoy-processor-examples (github.com)
<https://github.com/GoogleCloudPlatform/envoy-processor-examples>
In particular, there are two examples in the Go code of using streaming.
This one base64-encodes the HTTP response:
https://github.com/GoogleCloudPlatform/envoy-processor-examples/blob/f53b0d8698b76a0a586b60a42d3098d6b845dd14/go/cmd/processor/service.go#L611C9-L611C9
And this one calculates the hash of both the request and response by
reading the streaming body without modifying it:
https://github.com/GoogleCloudPlatform/envoy-processor-examples/blob/f53b0d8698b76a0a586b60a42d3098d6b845dd14/go/cmd/processor/service.go#L398
…On Mon, Dec 11, 2023 at 1:55 PM Mariano de Achaval ***@***.***> wrote:
@gbrail <https://github.com/gbrail> do you have a working example of
Streamed mode working I'm not able to make it work even on the most basic
example... only on buffered mode
—
Reply to this email directly, view it on GitHub
<#17069 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD7I27B5WQ5LL42ZPKNY2DYI56NJAVCNFSM47CF7742U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBVGA4TKMRUGYZQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Commit Message: Implement STREAMED body processing mode in ext_proc
Additional Description: Implement this mode, which allows an external processor to receive the body one chunk at a time and examine or modify the body while it is being processed.
Risk Level: Medium. The mode is only engaged if used. However an external processor must be coded carefully, particularly if it expects to stream both request and response bodies simultaneously, since each will proceed in its own ordering.
Testing: New unit and integration tests.
Docs Changes: Updated proto docs to reflect that the mode is now supported.
Release Notes: External processing servers may now use the STREAMED processing mode. In this mode, chunks of the body are forwarded to the external processing server when they arrive. Depending on how the upstream system is implemented, request body chunks may be delivered before or after the response headers, and request and response body chunks may be interleaved if the upstream system delivers them that way. An external processor should be carefully coded so that it does not assume that a particular ordering will be implemented.