wang-jiahua opened a new issue, #10968:
URL: https://github.com/apache/rocketmq/issues/10968
### Before Creating the Enhancement Request
- [x] I have confirmed that this should be classified as an enhancement
rather than a bug/feature.
### Summary
`EndTransactionProcessor#endMessageTransaction` runs three full properties
codec passes per transaction commit/rollback; two of them exist only to
deep-copy a map.
### Motivation
Every transaction commit/rollback goes through:
```java
// encode then decode, only to deep-copy the map
MessageAccessor.setProperties(msgInner,
MessageDecoder.string2messageProperties(MessageDecoder.messageProperties2String(msgExt.getProperties())));
...
// the real encode after clearProperty
msgInner.setPropertiesString(MessageDecoder.messageProperties2String(msgInner.getProperties()));
```
The first two passes (map -> String -> map) are just a copy constructor
implemented with the codec: one full map traversal + StringBuilder + String,
then a second traversal + substring allocations. Only the last encode is needed.
### Solution
Replace the round-trip with
`MessageAccessor.deepCopyProperties(msgExt.getProperties())`.
Behavior parity: the round-trip silently drops entries with null/empty
values, but at this call site `msgExt` is decoded from the store — the
properties parser never produces null/empty values, and `putUserProperty`
rejects blank values, so that filtering semantics is unreachable here. The
delivered message still encodes `propertiesString` after `clearProperty`, so
the wire format is unchanged.
### Benchmark
4-node cluster (8C32G, base RocketMQ 5.5.1), `benchmark.TransactionProducer`
32 threads / 1 KiB body / all-commit, per arm: clean store + broker restart +
page cache drop, 25 s warmup + 60 s collect, 3 interleaved trials:
| trial | arm | TPS | young GC | GC per million msgs | send failed |
|---|---|---|---|---|---|
| 1 | base | 64,927 | 25 | 6.42 | 0 |
| 1 | patch | 66,767 | 24 | 5.99 | 0 |
| 2 | base | 66,078 | 26 | 6.56 | 0 |
| 2 | patch | 64,868 | 24 | 6.17 | 0 |
| 3 | base | 66,781 | 25 | 6.24 | 0 |
| 3 | patch | 65,184 | 24 | 6.14 | 0 |
Broker young GC per million messages: median 6.42 -> 6.14 (-4.4%), patch
below base in all three trials; TPS flat, zero failures.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]