You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "lhotari (via GitHub)" <gi...@apache.org> on 2026/09/19 12:50:27 UTC
[PR] [improve][broker] Skip unused replicated subscription timestamp updates [pulsar]
lhotari opened a new pull request, #26655:
URL: https://github.com/apache/pulsar/pull/26655
### Motivation
Every successful normal publish advances the transaction buffer's maximum readable position. That path currently reads the wall clock and writes `lastMaxReadPositionMovedForwardTimestamp`, even when replicated subscriptions are not enabled for the topic.
`ReplicatedSubscriptionsController` is the only production consumer of this timestamp. On ordinary topics, the clock read and volatile write therefore add work to every publish without affecting broker behavior.
### Modifications
- Skip the timestamp update when the topic has no replicated-subscription controller.
- Seed the timestamp immediately before controller construction and again after publishing the controller reference. This makes the initial snapshot cover earlier messages and covers publishes racing with controller activation.
- Preserve marker handling, maximum-readable-position updates, transaction recovery, and snapshot scheduling behavior.
- Add lifecycle, transactional, recovery, and callback microbenchmark coverage.
### Performance
An actual-callback JMH benchmark measured the controller-absent path:
| Threads | Before | After | Change |
|---:|---:|---:|---:|
| 1 | 19.360 ns/op | 1.497 ns/op | -92.3% |
| 4 | 20.690 ns/op | 1.604 ns/op | -92.2% |
Allocation remains effectively zero. When a replicated-subscription controller is active, the added presence check measured 20.090 ns/op versus 19.360 ns/op for the unconditional baseline (+0.730 ns/op).
A five-million-message broker scenario with 500 producers and five Key_Shared subscriptions produced two positive matched comparisons:
| Pair | Before | After | Change |
|---:|---:|---:|---:|
| 1 | 61,423 msg/s | 75,164 msg/s | +22.4% |
| 2 | 58,497 msg/s | 62,952 msg/s | +7.6% |
The spread indicates substantial whole-host variance, so these runs establish repeatability and absence of a throughput regression rather than a precise effect size. Every run delivered all messages to every subscription with zero duplicates, ordering violations, or invalid messages.
### Verifying this change
This change added tests and can be verified as follows:
- Focused persistent-topic and replicated-subscription controller lifecycle tests
- Transaction commit and transaction-buffer recovery tests
- `./gradlew :microbench:shadowJar quickCheck`
- JMH with two forks, three 1-second warmups, five 1-second measurements, and GC profiling
### Does this pull request potentially affect one of the following parts:
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] The metrics
- [ ] Anything that affects deployment
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Skip unused replicated subscription timestamp updates [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari merged PR #26655:
URL: https://github.com/apache/pulsar/pull/26655
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org