Skip to content
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

Efficiency improvements for delay delivery tracker #5498

Merged
merged 1 commit into from
Oct 30, 2019

Conversation

merlimat
Copy link
Contributor

Motivation

Improved the delayed messages tracker to avoid scheduling the timer more frequently than intended.

Since we group messages in based on tickTimeMillis, the tracker will yield messages slightly before than when they're about to expire. This is by design. However the problem lies in that the messages are set to be dispatched and then they re-enter on the tracker (for the remained on the delay time, eg. < 1sec).

We should avoid re-inserting in the tracker since it's just wasted CPU time.

Also, check the less expensive delayedDeliveryTracker.hasMessageAvailable() before going to the full blown delayedDeliveryTracker.getScheduledMessages()

@merlimat merlimat added the type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages label Oct 29, 2019
@merlimat merlimat added this to the 2.4.2 milestone Oct 29, 2019
@merlimat merlimat self-assigned this Oct 29, 2019
@merlimat
Copy link
Contributor Author

run cpp tests

@jerrypeng
Copy link
Contributor

rerun cpp tests

@wolfstudy wolfstudy merged commit 467ffab into apache:master Oct 30, 2019
wolfstudy pushed a commit that referenced this pull request Nov 20, 2019
Efficiency improvements for delay delivery tracker

(cherry picked from commit 467ffab)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants