-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[improve][pip] PIP-282: Change definition of the recently joined consumers position #20776
[improve][pip] PIP-282: Change definition of the recently joined consumers position #20776
Conversation
@poorbarcode Sorry for the late reply. I addressed your comments. PTAL |
private final LinkedHashMap<Consumer, PositionImpl> recentlyJoinedConsumers; | ||
|
||
+ private PositionImpl lastSentPosition; | ||
+ private final RangeSetWrapper<PositionImpl> individuallySentPositions; |
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.
individuallySentPositions
={Range-Full} - {cursor.individualDeletedMessages} - {dispatcher.redeliveryMessages} - {the positions in inflight Replay Reading}
, right?- Should we add metrics to describe how much memory
individuallySentPositions
usage? - Should we add a mechanism to stop delivering messages to the client if
individuallySentPositions
uses more memory than expected?
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.
@equanz Sorry for the late reply. Could you take a look at these questions?
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.
individuallySentPositions = {Range-Full} - {cursor.individualDeletedMessages} - {dispatcher.redeliveryMessages} - {the positions in inflight Replay Reading}, right?
Roughly, the {cursor.individualDeletedMessages}
is not subtracted. It is initialized by individualDeletedMessages
. Messages scheduled to be sent are pushed to this field.
After, if the first range is contiguous to the last sent position, remove the first range and update the last sent position to the range's upper bound.
So, if it is not initialized by individualDeletedMessages
, then the last sent position can be stuck because of "sent-hole".
More specifically, the details may differ because the definitions are different.
Should we add metrics to describe how much memory individuallySentPositions usage?
I'll add these metrics to the subscription stats.
/** The last sent position of the cursor. This is for Key_Shared subscription. */
public String lastSentPosition;
/** Set of individually sent ranges. This is for Key_Shared subscription. */
public String individuallySentPositions;
Should we add a mechanism to stop delivering messages to the client if individuallySentPositions uses more memory than expected?
I referred to the definition of the individualDeletedMessages. It has no limitation to persist on the memory(not the storage).
(Of course, we can add the limitation if necessary.)
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.
I'll add these metrics to the subscription stats.
/** The last sent position of the cursor. This is for Key_Shared subscription. */
public String lastSentPosition;
/** Set of individually sent ranges. This is for Key_Shared subscription. */
public String individuallySentPositions;
But individuallySentPositions
in topic stats
doesn't accurately reflect how much memory individuallySentPositions
uses, right?
If there are a huge number of elements in individuallySentPositions
, it is possible that pulsar-admin topics stats
might not work, because the response body is too large (we have encountered responses close to 200m).
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.
But individuallySentPositions in topic stats doesn't accurately reflect how much memory individuallySentPositions uses, right?
Yes.
However, I think we can't do effective operations even if we can observe these metrics. What do you think?
If there are a huge number of elements in individuallySentPositions, it is possible that pulsar-admin topics stats might not work, because the response body is too large (we have encountered responses close to 200m).
Your concerns are correct. I'll reconsider any other approaches(e.g. add a new REST API to expose these stats, just output log as debug level).
BTW, it is not considered in stats(e.g. consumersAfterMarkDeletePosition, keyHashRanges) and stats-internal(e.g. individuallyDeletedMessages). We should care about these stats, too.
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.
it is not considered in stats(e.g. consumersAfterMarkDeletePosition, keyHashRanges) and stats-internal(e.g. individuallyDeletedMessages). We should care about these stats, too.
Yes, I'm planning to do it.
- compress the
individuallyDeletedMessages
to save place using, see: [improve] [ml] compress individual ack info to make maintain more records #21105 - A new PIP to limit the place usage of
individuallyDeletedMessages
, the PIP will be submitted today
Your concerns are correct. I'll reconsider any other approaches(e.g. add a new REST API to expose these stats, just output log as debug level).
After we added new metrics which indicate how much memory is used by individuallySentPositions
. Push an alert when the memory limit is exceeded, so there are no scenarios that the HTTP API cannot handle
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.
A new PIP to limit the place usage of individuallyDeletedMessages, the PIP will be submitted today
Okay.
If implementation is not far off, I will wait for your new design for reference.
(This PIP issue is one of bug fixes. So, I think we should fix it sooner if possible.)
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.
Sure. It is #21118
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.
@poorbarcode
Sorry for the late reply. I have reconsidered your comments.
This field is appended when messages sent are not contiguous, and is automatically removed when the delivery becomes contiguous.
The frequency of occurrence between instances where messages are not delivered and instances where messages are not acked, would likely differ.
We could add limitations as you mentioned. However, it raises questions about how often this would be effective.
Additionally, introducing such additional stoppage specifications for deliveries would impose more complex limitations on Key_Shared alone.
If these limitations work correctly, that would be ideal. However, past bugs suggest that these complexities often cause omission from consideration.
Hence, if these added limitations do not effectively contribute, it may be better to consider not imposing them in the first place.
The pr had no activity for 30 days, mark with Stale label. |
|
Sure, agree |
I have opened a voting thread, so please check it out. |
@nkurihar @poorbarcode @codelipenghui The vote was closed by 3 binding +1. Could you merge this proposal? |
Sure, merging |
I opened implementation PR #21953. |
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc
doc-required
doc-not-needed
doc-complete