Skip to content

[ISSUE #12672]✨Lay out the release Broker with BOLT after PGO - #12673

Merged
mxsm merged 1 commit into
mainfrom
enh-12672-broker-bolt
Nov 15, 2026
Merged

mxsm merged 1 commit into
mainfrom
enh-12672-broker-bolt

Conversation

@mxsm

@mxsm mxsm commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Which Issue(s) This PR Fixes(Closes)

Brief Description

The release Broker built by docker/Dockerfile.base is now laid out with BOLT after PGO.

  • builder-base installs bolt-19 from the pinned Debian snapshot.
  • With ROCKETMQ_BROKER_PGO=true, both PGO stages use v0 symbol names: BOLT 19 reads legacy names that contain ..cold as split function fragments, and the PGO profile must name functions the way the final build does. The final build also links with --emit-relocs.
  • The PGO Broker is instrumented with llvm-bolt -instrument, trained by the existing loopback script, and rewritten from the merged profile (-reorder-blocks=ext-tsp -reorder-functions=cdsort -split-functions -split-all-cold -split-eh -icf=1 -use-gnu-stack). Instrumentation is used because a build container cannot record hardware branch samples. The tools are started from /usr/lib/llvm-19/bin: llvm-bolt looks for its instrumentation runtime next to the directory it runs from, and Debian installs it under the LLVM prefix rather than next to /usr/bin/llvm-bolt-19.
  • scripts/pgo-train-broker.sh accepts ROCKETMQ_TRAINING_PROFILE_GLOB (default *.profraw) so the same training drives both instrumentations.
  • New build argument ROCKETMQ_BROKER_BOLT (default true, effective with PGO) keeps the PGO-only binary when set to false.
  • The container deployment page (en and zh-CN) and scripts/README.md describe the step and the switches.

The Broker binary grows from about 40 MB to about 59 MB: BOLT keeps the original text section, and v0 names are longer.

How Did You Test This Change?

  • Real docker buildx build --target service-builder of this tree (clean export, cold target cache): PGO training 22 s, BOLT instrumentation, BOLT training 22 s, merge-fdata, rewrite with 5,473 of 35,123 functions profiled, and the BOLT binary installed as the Broker. The first runs of this build caught two Debian-specific issues that container tests did not: the /usr/bin/llvm-bolt-19 link cannot find the instrumentation runtime, and llvm-bolt does not create its output directory.
  • docker buildx build --target broker: image 199 MB, Broker binary 58.9 MB. The image's Broker served sync, single-connection and four-connection async runs with 0 failures, and matched the container-built PGO+BOLT binary (async 95.9k vs 95.6k msg/s, user cycles 166.4k vs 166.4k per message).
  • Linux A/B in Docker against the same PGO build (release features, Broker pinned to 4 cores and clients to 4 others, store on tmpfs, two measurement sets of alternating rounds pooled: 8 runs per cell, 4 for sixteen connections, 0 failures):
Load Throughput Broker CPU/msg User cycles/msg
sync +0.5% -1.4% -5.8%
async, 1 connection x 256 +4.6% -4.5% -4.5%
async, 4 connections x 64 -0.3% -1.9% -2.4%
async, 16 connections x 16 +2.6% -5.1% -4.1%

User cycles fell in every set; throughput moved within about 3% between sets.

  • A profile from hardware branch sampling (LBR) instead of instrumentation gave the same gains in the first set, so the build loses nothing by instrumenting.
  • bash -n scripts/pgo-train-broker.sh.

🤖 Generated with Claude Code

@mxsm
mxsm merged commit 3c55e10 into main Nov 15, 2026
9 of 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✨] Lay out the release Broker with BOLT after PGO

3 participants