Skip to content

[ISSUE #12873]🐛Skip unused Broker send hook metadata scans - #12874

Merged
mxsm merged 1 commit into
mainfrom
mxsm/fix-sync-send-cycles
Nov 21, 2026
Merged

mxsm merged 1 commit into
mainfrom
mxsm/fix-sync-send-cycles

Conversation

@mxsm

@mxsm mxsm commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Which Issue(s) This PR Fixes(Closes)

Brief Description

The default Broker walked every extension field a second time to collect account metadata even when its send hook list was empty. Capture the metadata only for registered hooks. Ordinary, batch and transactional sends retain their hook behavior and request correlation ID. Move the transaction ID and recall handle into the response.

How Did You Test This Change?

  • Package formatting and 11 focused Broker tests passed on the rebased branch. The tests cover hook success and failure, duplicate account fields, no-hook sends, batch and transactional sends, one-way completion and the correlation ID before transport binding.
  • In separate release runs, 4,000 successful hookless sends on the parent produced 4,000 metadata captures and 56,000 field callbacks. The fixed Broker and the rebased release Broker each handled 4,000 successful sends with zero captures and zero field callbacks.
  • The comparisons ran on Linux x86-64 under WSL2 on an Intel Core i7-11700K. Each performance run used a fresh loopback Broker and NameServer, the same client executable, 1 KiB messages and one outstanding synchronous send. The Broker used logical CPUs 0-7 and the client used 8-15. Each fresh Broker boot sent 12,000 messages, or 36,000 for the final comparison. All measured requests completed successfully.
Comparison Independent boot pairs Before cycles/send After cycles/send Change Paired 95% interval
Original six changes, PGO+BOLT 8 361,491 366,670 +1.43% -0.23% to +3.67%
Original six changes, PGO only 6 495,598 495,481 -0.02% -1.51% to +1.51%
Original six changes, original 8 ms sampler 6 360,405 364,034 +1.01% -1.12% to +3.15%
Same executable before BOLT, independent BOLT training 6 360,033 364,727 +1.30% -0.15% to +3.14%
This fix only, PGO+BOLT 8 366,333 362,552 -1.03% -2.16% to -0.06%
This fix only, PGO only 6 496,682 482,747 -2.81% -4.76% to -1.20%
Historical baseline to the rebased fix, PGO+BOLT 6 365,057 355,321 -2.67% -4.97% to -0.59%

The original comparison from #12844 uses 391ed3e31 and 83da1b371. The isolated fix comparison uses 11fd90459 and the same revision with this change. The final row uses the historical baseline and the rebased PR head 7494648e6, including the main branch update to bytes 1.12.2. The squash commit beaf6ea7b also picked up the concurrent clap and clap_derive 4.6.8 lockfile update and passed the same 11 tests. Cycle measurements use the PR head as indicated in the table. The Rust PGO input was identical. Independently retraining BOLT on a single input executable changed the hot text. Reapplying the original profile reproduced the original text byte for byte.

For the isolated release comparison, retired instructions per send changed from 186,741 to 184,328 (-1.29%). The primary statistic is the ratio of total Broker cycles per completed message. Intervals resample whole boot pairs. The diagnostic sampler groups counters per thread, differences raw counts and running times inside the client measurement window and cross-checks task time against process CPU time.

Enabling the original sampler increased client elapsed time per message by 7.49% on the same executable. Changing only its polling interval from 8 ms to 75 ms changed cycles per send by -0.46% across four repeated boots.

The earlier +21.2% came from two pairs. Those runs retained aggregate counters only. Their executable layouts and thread scheduling history are unavailable, so the specific cause of those two observations cannot be reconstructed. The unconditional hook scan was present on both historical revisions.

Paired cycle changes in execution order
  • The original PGO+BOLT pairs changed by +6.32%, -0.31%, -0.07%, +0.19%, -0.02%, +0.36%, -0.95%, +6.03%.
  • The isolated fix pairs changed by -0.01%, -0.11%, -0.46%, -2.18%, -1.15%, +1.07%, -1.03%, -4.22%.
  • The historical baseline to rebased fix pairs changed by -7.36%, -1.55%, +0.49%, -0.71%, -4.96%, -1.49%.

@rocketmq-rust-bot

Copy link
Copy Markdown
Collaborator

🔊@mxsm 🚀Thanks for your contribution🎉!

@rocketmq-rust-robot rocketmq-rust-robot added the bug🐛 Something isn't working label Nov 21, 2026
@mxsm
mxsm merged commit beaf6ea into main Nov 21, 2026
11 of 12 checks passed
@rocketmq-rust-bot rocketmq-rust-bot added approved PR has approved and removed ready to review waiting-review waiting review this PR labels Nov 21, 2026
@mxsm
mxsm deleted the mxsm/fix-sync-send-cycles branch November 21, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved PR has approved auto merge bug🐛 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug🐛] Investigate the Broker CPU cycle increase for synchronous sends

3 participants