-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[improve][broker] PIP-442: Add memory limits for topic list watcher (part 2) #25070
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #25070 +/- ##
=============================================
+ Coverage 38.69% 74.43% +35.74%
- Complexity 13166 34067 +20901
=============================================
Files 1842 1899 +57
Lines 145548 149813 +4265
Branches 16917 17418 +501
=============================================
+ Hits 56313 111511 +55198
+ Misses 81537 29396 -52141
- Partials 7698 8906 +1208
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Denovo1998
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments.
...g/apache/pulsar/client/api/PatternConsumerTopicWatcherBackPressureMultipleConsumersTest.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/TopicListService.java
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/TopicListService.java
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/TopicListService.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements memory limits for topic list watcher operations as part of PIP-442. It introduces backpressure mechanisms to prevent broker memory exhaustion when handling concurrent pattern consumer topic list requests by applying memory limiting to topic list watcher creation and update operations.
Key Changes
- Added memory limit acquisition with retry logic for topic list watcher initialization and updates
- Modified topic list watcher to queue updates during initialization to avoid race conditions
- Enhanced test coverage for memory limiting scenarios and concurrent consumer patterns
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pulsar-common/src/main/java/org/apache/pulsar/common/semaphore/AsyncSemaphoreImpl.java | Added toString method to SemaphorePermit for debugging |
| pulsar-common/src/main/java/org/apache/pulsar/common/semaphore/AsyncDualMemoryLimiterImpl.java | Added toString method to DualMemoryLimiterPermit for debugging |
| pulsar-broker/src/test/java/org/apache/pulsar/client/api/PatternConsumerTopicWatcherBackPressureMultipleConsumersTest.java | New test validating backpressure with 100 concurrent pattern consumers and 300 topics |
| pulsar-broker/src/test/java/org/apache/pulsar/broker/service/TopicListWatcherTest.java | Updated test setup to use direct executor and verify watcher initialization completion |
| pulsar-broker/src/test/java/org/apache/pulsar/broker/service/TopicListServiceTest.java | Added comprehensive tests for permit acquisition retries and memory limiting scenarios |
| pulsar-broker/src/main/java/org/apache/pulsar/broker/service/TopicListService.java | Implemented memory limiting with retry backoff for watcher operations and queued updates during initialization |
| pulsar-broker/src/main/java/org/apache/pulsar/broker/service/PulsarCommandSenderImpl.java | Modified methods to acquire direct memory permits before sending topic list messages |
| pulsar-broker/src/main/java/org/apache/pulsar/broker/service/PulsarCommandSender.java | Updated interface to return CompletableFuture and accept error handler for permit acquisition |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/PulsarCommandSenderImpl.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/PulsarCommandSenderImpl.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/TopicListServiceTest.java
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
PIP-442
Motivation
See PIP-442.
This is part 2 for the PIP-442 implementation. This covers the topic list watcher operations.
The first part of PIP-442 implementation was #24833.
Modifications
Documentation
docdoc-requireddoc-not-neededdoc-complete