You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Broker cache eviction evicts entries that haven't been read by active consumers #16054
There's a performance regression with large fan-outs (large number of consumers).
#12045 changed cache eviction. The problem is that cache eviction is done to the position whatever happens to be the first cursor in the "heap" list in ManagedCursorContainer. There's a chance for a race condition: another cursor in the list might have an older position, but that hasn't been updated in the ordered data structure ("heap") when the method is called. The cache eviction will take the read position directly from the first cursor and it ignores and older positions.
When the consumer for the other cursor does a read, the entries are no more in the cache and there will be a cache miss.
To Reproduce
It should be possible to reproduce this in a multi-consumer scenario where the speed of the consumers varies.
Expected behavior
Cache eviction should properly consider all active consumers. This was the state before #12045 and #14985 changes.
Activity
lhotari commentedon Jun 14, 2022
@315157973 @lordcheng10 @merlimat @codelipenghui What's your thoughts on this issue?
I wonder if the need for #14985 was caused by the regression described in this issue?
lhotari commentedon Jul 12, 2022
@315157973 @lordcheng10 @merlimat @codelipenghui please take a look at this issue since it seems that the broker cache is broken atm.
eolivelli commentedon Jul 12, 2022
this is partially related
#16421
lordcheng10 commentedon Jul 27, 2022
In #14985, miss cache is caused by data re-pushing due to restart of some consumer clients @lhotari
[WIP][fix][broker] Keep sorted list of cursors ordered by read positi…
[fix][broker] Keep sorted list of cursors ordered by read position of…
[fix][broker] Keep sorted list of cursors ordered by read position of…
[fix][broker] Fix broker cache eviction of entries read by active cur…
[fix][broker] Fix broker cache eviction of entries read by active cur…
[fix][broker] Fix broker cache eviction of entries read by active cur…
[fix][broker] Fix broker cache eviction of entries read by active cur…