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
[Performance] Optimize allocations in ManagedLedgerImpl.getEarlierReadPositionForActiveCursors()/ManagedCursorContainer.iterator() #9958
@merlimat would you mind taking a look at this issue? In the stack trace it shows that ConcurrentSkipListMap is used in ManagedCursorContainer. Would there be a benefit to switch over to ConcurrentOpenHashMap?
I understood from our earlier discussions that you have optimized it for minimal allocations.
It seems that adjusting managedLedgerCacheEvictionFrequency configuration value is one way to workaround the performance issue. The description of this configuration setting is "Configure the cache eviction frequency for the managed ledger cache (evictions/sec)" , default value is 100.0 .
Why does the cache eviction have to run 100 times per second by default?
The main reason is to make sure the data stays cached for least possible amount of time.
The data itself is not the main problem (it's already stored in pooled direct memory and there's a max size to the cache).
The problem typically comes from the tracking objects that are stored in the cache (eg: the pointers to the data). The current implementation is based on the ConcurrentSkipListMap which stores the objects and Nodes to hold them. All these objects, if they're cached for significant amount of time will be candidate to get pushed down to the old-gen when the young-gen is compacted, and will have to get compacted there later, causing longer gc pauses.
This was true for G1GC, although it might not be exactly the same with ZGC (hence: the threshold and tradeoff considerations will vary).
Activity
lhotari commentedon Mar 18, 2021
@merlimat would you mind taking a look at this issue? In the stack trace it shows that ConcurrentSkipListMap is used in ManagedCursorContainer. Would there be a benefit to switch over to ConcurrentOpenHashMap?
I understood from our earlier discussions that you have optimized it for minimal allocations.
lhotari commentedon Mar 19, 2021
@merlimat This performance problem has also been reported on Pulsar Slack in this discussion: https://apache-pulsar.slack.com/archives/C5Z4T36F7/p1614293057103600 .
It seems that adjusting
managedLedgerCacheEvictionFrequencyconfiguration value is one way to workaround the performance issue. The description of this configuration setting is "Configure the cache eviction frequency for the managed ledger cache (evictions/sec)" , default value is100.0.Why does the cache eviction have to run 100 times per second by default?
merlimat commentedon Mar 29, 2021
The main reason is to make sure the data stays cached for least possible amount of time.
The data itself is not the main problem (it's already stored in pooled direct memory and there's a max size to the cache).
The problem typically comes from the tracking objects that are stored in the cache (eg: the pointers to the data). The current implementation is based on the
ConcurrentSkipListMapwhich stores the objects and Nodes to hold them. All these objects, if they're cached for significant amount of time will be candidate to get pushed down to the old-gen when the young-gen is compacted, and will have to get compacted there later, causing longer gc pauses.This was true for G1GC, although it might not be exactly the same with ZGC (hence: the threshold and tradeoff considerations will vary).
codelipenghui commentedon Mar 4, 2022
The issue had no activity for 30 days, mark with Stale label.
lhotari commentedon Jun 7, 2022
Will be addressed by "PIP-174: Provide new implementation for broker dispatch cache" , #15954 / #15955
[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…