codelipenghui opened a new pull request, #20647:
URL: https://github.com/apache/pulsar/pull/20647

   ### Motivation
   
   The issue has happened for a topic that has many producers. When many 
producers connect/disconnect to the topic, the P99 publish latency of the 
broker will go up to hundreds of ms, which is unacceptable for a messaging 
system.
   
   Each producer add/remove operation will go to MessageDeduplication to update 
a map for inactive producers regardless of whether message deduplication is 
enabled or disabled. My first intuitive impression is it shouldn't go to 
MessageDeduplication if the message deduplication is disabled. But users can 
enable the message deduplication for an active topic. It might be the reason, 
but I'm not 100% sure about it. @merlimat Do you happen to have more context 
about it? And we might also need to look for a solution to avoid any operations 
to the MessageDeduplication if the message deduplication is disabled.
   
   This PR provides a fix without introducing behavior changes, so we will be 
more confident to cherry-pick to release branches.
   
   <img width="1900" alt="image" 
src="https://github.com/apache/pulsar/assets/12592133/87c22ac2-2af9-4190-a1f2-1872477dd0c4";>
   
[broker_lock_0621_1.html.txt](https://github.com/apache/pulsar/files/11863016/broker_lock_0621_1.html.txt)
   
   
   ### Modifications
   
   Use ConcurrentOpenHashMap instead of synchronized HashMap to reduce the 
contention between IO threads.
   
   ### Verifying this change
   
   The existing tests can cover the new changes.
   
   ### Does this pull request potentially affect one of the following parts:
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   *If the box was checked, please highlight the changes*
   
   - [ ] 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
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   


-- 
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]

Reply via email to