goaymode created IGNITE-25822:
---------------------------------
Summary: Potential Performance Impact from Lock-Contended
Iterations in Eviction
Key: IGNITE-25822
URL: https://issues.apache.org/jira/browse/IGNITE-25822
Project: Ignite
Issue Type: Improvement
Components: cache
Affects Versions: 2.16
Reporter: goaymodeThere could be performance degradation when [batchEvict|https://github.com/apache/ignite/blob/cbea746ced87dc9582ffb4c8e1f1ab44fc75c55d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java#L281] processes a large number of keys. Each iteration calls [evictInternal()|https://github.com/apache/ignite/blob/cbea746ced87dc9582ffb4c8e1f1ab44fc75c55d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java#L3673], which acquires an entry-level lock before proceeding with operations like [GridCacheMapEntry.deferredDelete()|https://github.com/apache/ignite/blob/cbea746ced87dc9582ffb4c8e1f1ab44fc75c55d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java#L3696C30-L3696C46], [GridCacheMapEntry.deletedUnlocked|https://github.com/apache/ignite/blob/cbea746ced87dc9582ffb4c8e1f1ab44fc75c55d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java#L3696C30-L3696C46] and [GridCacheMapEntry.markObsolete0()|https://github.com/apache/ignite/blob/cbea746ced87dc9582ffb4c8e1f1ab44fc75c55d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java#L3699]. In particular, [markObsolete0()|https://github.com/apache/ignite/blob/cbea746ced87dc9582ffb4c8e1f1ab44fc75c55d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java#L2041] calls [GridCacheMvcc.isEmpty|https://github.com/apache/ignite/blob/cbea746ced87dc9582ffb4c8e1f1ab44fc75c55d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java#L448], which performs a linear scan over both local and remote MVCC candidate lists. Long-running transactions can cause these lists to grow large, increasing the cost of each scan and lengthening the time lock is held. When this scanning is repeated across many keys or maybe if there are lots of removals like in [Ignite-5286] , lock contention is amplified, negatively impacting performance. -- This message was sent by Atlassian Jira (v8.20.10#820010)
