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

[fix][broker] Avoid introducing delay when there are delayed messages or marker messages #23343

Merged
merged 2 commits into from
Sep 25, 2024

Conversation

lhotari
Copy link
Member

@lhotari lhotari commented Sep 24, 2024

Motivation

PR #23226 introduced a change to introduce a delay before calling readMoreEntries in PersistentDispatcherMultipleConsumers classes when no messages were dispatched.
This logic didn't take into account the case when all messages are delayed messages, marker messages or messages from an aborted transaction. In those cases additional delays would be introduced, causing performance regressions.

Modifications

  • add a failing test case that simulates dispatching a delayed message that gets filtered
    • no delay should be introduced before the next call to readMoreEntries
  • Fix the regression by tracking how many entries were "processed" by consumers in the last round instead of tracking how many entries were dispatched.
    • lastNumberOfEntriesProcessed tracks how many entries were processed by consumers in the last trySendMessagesToConsumers call
    • the number includes also delayed messages, marker messages, aborted txn messages and filtered messages
    • When no messages were processed, the value is 0. This is also an indication that the dispatcher didn't make progress in the last trySendMessagesToConsumers call. Only in those cases should the retry happen after a delay with increasing backoff.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 74.56%. Comparing base (bbc6224) to head (957117d).
Report is 599 commits behind head on master.

Files with missing lines Patch % Lines
...sistent/PersistentDispatcherMultipleConsumers.java 92.85% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23343      +/-   ##
============================================
+ Coverage     73.57%   74.56%   +0.99%     
- Complexity    32624    34443    +1819     
============================================
  Files          1877     1934      +57     
  Lines        139502   144990    +5488     
  Branches      15299    15838     +539     
============================================
+ Hits         102638   108116    +5478     
+ Misses        28908    28591     -317     
- Partials       7956     8283     +327     
Flag Coverage Δ
inttests 27.57% <65.00%> (+2.99%) ⬆️
systests 24.57% <65.00%> (+0.25%) ⬆️
unittests 73.91% <95.00%> (+1.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ersistentStickyKeyDispatcherMultipleConsumers.java 89.15% <100.00%> (+3.51%) ⬆️
...sistent/PersistentDispatcherMultipleConsumers.java 75.50% <92.85%> (+1.17%) ⬆️

... and 603 files with indirect coverage changes

Copy link
Member

@dao-jun dao-jun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@lhotari lhotari merged commit 5ea4252 into apache:master Sep 25, 2024
57 of 58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs ready-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants