Skip to content

[ISSUE #12803]✨Build the release-image Proxy with profile-guided optimization - #12804

Merged
mxsm merged 1 commit into
mainfrom
issue-12803-proxy-pgo
Nov 19, 2026
Merged

mxsm merged 1 commit into
mainfrom
issue-12803-proxy-pgo

Conversation

@mxsm

@mxsm mxsm commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Which Issue(s) This PR Fixes(Closes)

Brief Description

Release images built the Broker with PGO and BOLT but the Proxy as a plain release build. This PR trains and builds the Proxy with profile-guided optimization as well.

  • rocketmq-proxy/examples/grpc_send_benchmark.rs: a gRPC send load generator. Each RPC carries one message, each connection is its own client, and each keeps --inflight sends outstanding; it reports throughput and p50/p99 latency as JSON and fails when a send fails. It drives the training and can be used as a benchmark.
  • scripts/pgo-train-proxy.sh: starts a NameServer, a Broker and an instrumented cluster-mode Proxy on loopback, creates the topics through the Broker with the client benchmark, and sends through the Proxy: synchronously, with one connection and 256 in flight, with 4 connections x 64 and with 32 connections x 4. The Proxy writes its profile when it exits after SIGTERM.
  • docker/Dockerfile.base: a new build argument ROCKETMQ_PROXY_PGO (default true). The Proxy is now built after the Broker: an instrumented build, training in front of the final Broker, llvm-profdata merge, and the release build with the profile, each in its own target directory. ROCKETMQ_PROXY_PGO=false keeps the plain build.
  • .gitattributes: the new script stays LF. rocketmq-website (English and Chinese) documents the build argument and the measured effect.

How Did You Test This Change?

  • In a Linux container from this branch, ran the commands of the new Dockerfile block: the instrumented Proxy build, the client and gRPC benchmark examples, scripts/pgo-train-proxy.sh against a release Broker (trained in 25 s, 0 failed sends), the profile merge and the PGO build: all succeeded. cargo clippy --release -p rocketmq-proxy --example grpc_send_benchmark -- -D warnings and cargo fmt -p rocketmq-proxy -- --check: clean.
  • Linux A/B in Docker of the plain release Proxy against the PGO Proxy (cluster mode, gRPC, one 1 KiB message per RPC; NameServer, Broker and Proxy pinned to 8 CPUs and the client to 8 others; the same Broker), three rotated rounds of two runs, 0 failures. Medians:
Load Proxy CPU/msg, plain Proxy CPU/msg, PGO Throughput, plain Throughput, PGO
sync, 1 in flight 222.7 us 184.0 us (-17%) 2.62k 2.89k (+10%)
1 connection x 256 107.7 us 97.3 us (-10%) 38.9k 38.6k (-1%)
4 connections x 64 94.3 us 81.8 us (-13%) 49.6k 53.1k (+7%)
32 connections x 4 107.2 us 90.6 us (-15%) 42.5k 45.7k (+8%)
  • Proxy user-mode cycles per message fell 15% to 34% and instructions 17% to 18%. p50 latency was lower in every load. With one connection and 256 in flight, p99 rose from about 14 ms to about 20 ms in every run, while p50 fell from 5.8 to 5.2 ms; the other loads kept or lowered p99.
  • One more round with the profile trained by the script and example in this PR gave the same picture: Proxy CPU per message -11% to -18%, throughput +11% (sync), +7% (4 x 64) and +6% (32 x 4).

🤖 Generated with Claude Code

@mxsm
mxsm merged commit 38d0374 into main Nov 19, 2026
10 checks passed
@rocketmq-rust-bot

Copy link
Copy Markdown
Collaborator

🔊@mxsm 🚀Thanks for your contribution🎉!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement✨] Build the release-image Proxy with profile-guided optimization

3 participants