Skip to content

Conversation

@stephanos
Copy link
Contributor

@stephanos stephanos commented Jan 24, 2026

What changed?

Replaces the real grpc networking implementation in functional tests with an in-process/inline implementation.

Inspired by #6733

Why?

The goal is to reduce CPU usage and memory allocation (which in turn reduces GC pressure) in order to reduce CI test times.

Local benchmark

Screenshot 2026-01-26 at 2 39 08 PM

NOTE: UpdateWorkflowSdkSuite likely shows less improvement due to the SDK Worker which is still using the real network.

No test execution time improvement was recorded locally (I suspect tests are largely IO bound ...).

CI comparison

Comparison with random CI run from main.

Screenshot 2026-01-26 at 4 13 35 PM

Most jobs showed a minor reduction of a few minutes in execution time.

NOTE: CI runners (being cloud-based) are known to show inconsistent performance.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

Potential risks

There's a risk that the inline gRPC skips/hides behavior we'd see in a real network. I believe this is a minimal risk; and should be mitigated by our nightly stress testing pipeline that runs on a real (cloud) network.

@stephanos stephanos changed the title Fake grpc Fake grpc [WiP] Jan 24, 2026
@dnr
Copy link
Contributor

dnr commented Jan 24, 2026

See this old draft pr: #6733. I wanted to try using it in production too, eventually.

@stephanos
Copy link
Contributor Author

stephanos commented Jan 24, 2026

@dnr I remember this! I wonder if we can re-use rpc/inline for both purposes; let me try this. My main motivation here, as you can imagine, is speeding up tests through fewer allocations and CPU usage.

Conceptually I see (1) test-to-service and (2) service-to-service and (3) service-to-sdkworker communication. During testing it'd be great to optimize at least (1) and even better also (2) with this.

@stephanos stephanos force-pushed the fake-network branch 6 times, most recently from 40e6952 to 202733e Compare January 24, 2026 21:02
@stephanos stephanos changed the title Fake grpc [WiP] Inline grpc [WiP] Jan 24, 2026
@stephanos stephanos force-pushed the fake-network branch 5 times, most recently from 318cc62 to acaf6a3 Compare January 24, 2026 22:35
@stephanos stephanos changed the title Inline grpc [WiP] Inline grpc in functional tests [WiP] Jan 24, 2026
@stephanos stephanos force-pushed the fake-network branch 13 times, most recently from 81d58eb to 921d00c Compare January 26, 2026 19:08
@stephanos stephanos force-pushed the fake-network branch 3 times, most recently from 6c772a0 to 132177a Compare January 26, 2026 20:43
Comment on lines +391 to +393
Attributes: &commandpb.Command_CompleteWorkflowExecutionCommandAttributes{
CompleteWorkflowExecutionCommandAttributes: &commandpb.CompleteWorkflowExecutionCommandAttributes{},
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[31mFailed�[0m
2026-01-26T20:36:04.8205423Z === �[31mFAIL�[0m: tests TestQueryWorkflowSuite/TestQueryWorkflow_FailurePropagated (4.13s)
2026-01-26T20:36:04.8206050Z     functional_test_base.go:373: Running TestQueryWorkflowSuite/TestQueryWorkflow_FailurePropagated in test shard 1/3
2026-01-26T20:36:04.8206195Z     query_workflow_test.go:395: 
2026-01-26T20:36:04.8206629Z         	Error Trace:	/home/runner/work/temporal/temporal/tests/query_workflow_test.go:395
2026-01-26T20:36:04.8206842Z         	Error:      	Received unexpected error:
2026-01-26T20:36:04.8208035Z         	            	BadCompleteWorkflowExecutionAttributes: CompleteWorkflowExecutionCommandAttributes is not set on CompleteWorkflowExecutionCommand.
2026-01-26T20:36:04.8208395Z         	Test:       	TestQueryWorkflowSuite/TestQueryWorkflow_FailurePropagated

Apparently the protobuf deserialization implicitly initializes this? Since that's gone now doing it explicitly here now.

@stephanos stephanos force-pushed the fake-network branch 3 times, most recently from 0c42462 to f553f41 Compare January 26, 2026 23:35
Port the inline RPC implementation from PR temporalio#6733 "Inline matching/history
rpcs and local load balancing". This provides an in-process gRPC client
that routes calls directly to handlers without network overhead.

Key changes:
- Add common/rpc/inline package with ClientConn implementing grpc.ClientConnInterface
- Change RPCFactory interface to return grpc.ClientConnInterface instead of *grpc.ClientConn
- Update client/history to use interface type with type assertion for ResetConnectBackoff

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@stephanos stephanos force-pushed the fake-network branch 2 times, most recently from 9f7b6bf to 76788fe Compare January 27, 2026 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants