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
Hi, It seems like ext-proc will call the process over gRPC with multiple stages as soon as it can. In case I need to maintain some state per HTTP request on the external server, I'm curious if there's anything we could leverage in ext-proc.
In the WASM filter, each httpContext corresponds to a single HTTP request lifecycle (request/response), meaning the application does not need to manage its own state. I'm wondering if there's a similar mechanism in ext-proc.
For example, how can we check whether an incoming onResponseHeaders is part of the same HTTP request stream as a previous onRequestHeaders call without maintaining the state ourselves?
Some custom solutions I could come up with:
Whenever I receive ProcessingRequest_RequestHeaders, generate a unique contextId or leverage the envoy requestId attribute.
Keep the state based on the contextId in our own logic.
Whenever I receive ProcessingRequest_ResponseHeaders, use the contextId to retrieve the proper state.
It would be great if we have a way to abstract away the above custom logic for maintaining the state, or it might be better to keep the logic externally from envoy, appreciate any insight!
The text was updated successfully, but these errors were encountered:
xr
changed the title
Question about the state across multiple phases calls in ext-proc for a HTTP request lifecycle
Question about managing state across multiple phases calls in ext-proc for a HTTP request lifecycle
Jul 22, 2024
HI, @xr
One way I can think of is to have the ext_proc server to track the gRPC stream open/close events, as Envoy starts a new gRPC stream to communicate with ext_proc server for each HTTP stream.
@xr No additional work is required from ext_proc filter side as such an affinity model has already been maintained in ext_proc's gRPC callout.
This can be purely your external server logic: On the first event (e.g., request header), server has a unique ID per stream and maintain it throughout HTTP lifecycle (request/response).
We actually have an internal product that is doing something similar. And it has been working well.
@yanjunxiang-google@tyxia thanks for the info! good to hear that you are doing sth similar, if each http stream is corresponding with one grpcStream then I could also store the http state inside grpc stream.
Hi, It seems like ext-proc will call the process over gRPC with multiple stages as soon as it can. In case I need to maintain some state per HTTP request on the external server, I'm curious if there's anything we could leverage in ext-proc.
In the WASM filter, each httpContext corresponds to a single HTTP request lifecycle (request/response), meaning the application does not need to manage its own state. I'm wondering if there's a similar mechanism in ext-proc.
For example, how can we check whether an incoming
onResponseHeaders
is part of the same HTTP request stream as a previousonRequestHeaders
call without maintaining the state ourselves?Some custom solutions I could come up with:
ProcessingRequest_RequestHeaders
, generate a uniquecontextId
or leverage the envoyrequestId
attribute.contextId
in our own logic.ProcessingRequest_ResponseHeaders
, use thecontextId
to retrieve the proper state.It would be great if we have a way to abstract away the above custom logic for maintaining the state, or it might be better to keep the logic externally from envoy, appreciate any insight!
The text was updated successfully, but these errors were encountered: