You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Sophie Blee-Goldman (JIRA)" <ji...@apache.org> on 2019/03/12 00:11:00 UTC
[jira] [Commented] (KAFKA-8094) Iterating over cache with get(key)
is inefficient
[ https://issues.apache.org/jira/browse/KAFKA-8094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16790070#comment-16790070 ]
Sophie Blee-Goldman commented on KAFKA-8094:
--------------------------------------------
After some investigation, the solution is not as straightforward as simply replacing TreeMap -> ConcurrentSkipListMap and using a subMap iterator. Iterators are only weakly consistent, and changes to the underlying map are not guaranteed to be reflected in the iterator. Implementing it this way may cause, for example, evicted entries to still be returned by the iterator (see ThreadCacheTest#shouldSkipEntriesWhereValueHasBeenEvictedFromCache)
> Iterating over cache with get(key) is inefficient
> --------------------------------------------------
>
> Key: KAFKA-8094
> URL: https://issues.apache.org/jira/browse/KAFKA-8094
> Project: Kafka
> Issue Type: Improvement
> Reporter: Sophie Blee-Goldman
> Priority: Major
> Labels: streams
>
> Currently, range queries in the caching layer are implemented by creating an iterator over the subset of keys in the range, and calling get() on the underlying TreeMap for each key. While this protects against ConcurrentModificationException, we can improve performance by replacing the TreeMap with a concurrent data structure such as ConcurrentSkipListMap and then just iterating over a subMap.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)