From 9bf057dda09995464b45d9ac1c5cb5aa508fe215 Mon Sep 17 00:00:00 2001 From: Peter Veentjer Date: Tue, 14 Jul 2020 09:02:22 +0300 Subject: [PATCH 1/2] Resolved performance problem with PagingPredicate JDK8 There is a very severe performance issue with JDK 8 in combination with the paging predicate. This is caused by SubList.sort. The problem is fixed by switching from LinkedList to ArrayList in the QueryResult. Benchmarks are included in the ticket fix #17207 --- .../main/java/com/hazelcast/map/impl/query/QueryResult.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hazelcast/src/main/java/com/hazelcast/map/impl/query/QueryResult.java b/hazelcast/src/main/java/com/hazelcast/map/impl/query/QueryResult.java index fa3e5781ad84..7991aae68215 100644 --- a/hazelcast/src/main/java/com/hazelcast/map/impl/query/QueryResult.java +++ b/hazelcast/src/main/java/com/hazelcast/map/impl/query/QueryResult.java @@ -30,6 +30,7 @@ import com.hazelcast.internal.util.collection.PartitionIdSet; import java.io.IOException; +import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -62,7 +63,7 @@ */ public class QueryResult implements Result, Iterable { - private List rows = new LinkedList(); + private List rows = new ArrayList(); private PartitionIdSet partitionIds; private IterationType iterationType; From f3d5a13f70c587c2161bd3ad213e74cc9163a0d2 Mon Sep 17 00:00:00 2001 From: Peter Veentjer Date: Tue, 14 Jul 2020 09:59:55 +0300 Subject: [PATCH 2/2] There is a very severe performance issue with JDK 8 in combination with the paging predicate. This is caused by SubList.sort. This issue is resolved with JDK9 but we need to fix the issue for a large number of people using JDK 8 The problem is fixed by switching from LinkedList to ArrayList in the QueryResult. Benchmarks are included in the ticket fix #17207 --- .../src/main/java/com/hazelcast/map/impl/query/QueryResult.java | 1 - 1 file changed, 1 deletion(-) diff --git a/hazelcast/src/main/java/com/hazelcast/map/impl/query/QueryResult.java b/hazelcast/src/main/java/com/hazelcast/map/impl/query/QueryResult.java index 7991aae68215..3161385eaaaa 100644 --- a/hazelcast/src/main/java/com/hazelcast/map/impl/query/QueryResult.java +++ b/hazelcast/src/main/java/com/hazelcast/map/impl/query/QueryResult.java @@ -32,7 +32,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import java.util.ListIterator; import java.util.Map;