Repository navigation
Decode inbound remote codec payloads concurrently - #1287
sattwikbhakta26 wants to merge 2 commits into
Conversation
Configure bounded concurrency on the inbound remote payload codec gRPC visitor (default 16) via go.temporal.io/api/proxy's VisitPayloadsOptions and add a --codec-concurrency flag (allowing --codec-concurrency 1 for sequential decoding against rate-limited codec servers). Also clone http.DefaultTransport in newRemotePayloadCodec with MaxIdleConnsPerHost matched to the configured concurrency so keep-alive connections are reused across concurrent decode waves. Closes temporalio#1193
|
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf551cceef
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Share a single buffered-channel semaphore across all gRPC invocations on the client inside newPayloadCodecGRPCClientInterceptor so commands that issue parallel RPCs on the same client (such as `workflow trace`) still strictly respect --codec-concurrency (including --codec-concurrency 1). Also set MaxConnsPerHost alongside MaxIdleConnsPerHost on the cloned HTTP transport to prevent extra connections from opening under load, and add multi-RPC concurrency and cancellation tests.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4234034663
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if defaultTransport, ok := http.DefaultTransport.(*http.Transport); ok { | ||
| transport := defaultTransport.Clone() | ||
| transport.MaxIdleConnsPerHost = maxConnsPerHost | ||
| transport.MaxConnsPerHost = maxConnsPerHost |
There was a problem hiding this comment.
Avoid throttling outbound codec requests with the inbound limit
When an HTTP/1.1 codec is used and callers issue concurrent payload-bearing RPCs on one client, this transport-wide cap also applies to /encode: with --codec-concurrency 1, outbound encodes serialize and a slow encode can block inbound decoding. That contradicts the generated help's “Maximum number of concurrent inbound requests” (cliext/flags.gen.go:108) and the explicit zero outbound traversal limit; before this change the default transport imposed no per-host active-connection cap. The shared inboundSem already bounds /decode, so do not derive the all-direction MaxConnsPerHost from the inbound setting.
Useful? React with 👍 / 👎.
Related issues
Closes #1193
What changed?
Previously,
cliext.ClientOptionsBuilder.Buildconfigured remote payload codecs usingconverter.NewPayloadCodecGRPCClientInterceptor, which leavesproxy.VisitPayloadsOptions.ConcurrencyLimitunset (0), causing every visited payload in a gRPC response (such astemporal workflow show --output json) to be decoded serially over HTTP.This PR:
cliext/client.gowith a directproxy.NewPayloadVisitorInterceptorhelper (newPayloadCodecGRPCClientInterceptor) that:16).0), keeping the change tightly scoped to decoding latency while leaving the helper structured for future outbound concurrency if desired.SkipSearchAttributes: trueon both inbound and outbound visitors.--codec-concurrencyclient flag (cliext/option-sets.yaml+ regeneratedcliext/flags.gen.go, default16) so users with rate-limited or single-threaded codec servers can tune concurrency down (e.g.,--codec-concurrency 1for strictly sequential decoding) or up. Rejects invalid values< 1.http.DefaultTransportinnewRemotePayloadCodecand setsMaxIdleConnsPerHostto match the configured concurrency (instead of Go's default of2) so concurrent/decodewaves reuse keep-alive connections without mutating the global default transport.cliext/client_test.gocovering:X-Namespace,Authorization,--codec-header), and HTTP keep-alive connection reuse (ConnState).--codec-concurrency 1is configured.0concurrency values.Checklist
Stability
Design
Help text
Behavior
Tests
TestSharedServerSuite/TestWorkflow_Execute_CodecEndpoint)cliext/client_test.go)Manual tests
Setup
Run a local Temporal server and a remote codec server (e.g. on
http://localhost:8081), and execute a workflow with multiple payload-bearing events.Happy path
Error case