Skip to content

Commit

Permalink
[Profiling] Query in parallel on content nodes
Browse files Browse the repository at this point in the history
In order to take advantage of inherent parallelism of modern SSDs, we
slice keys and issue multiple mgets concurrently. In elastic#103061 we have
introduced an additional heuristic to disable that behavior on the warm
and cold tier which usually use spinning disks. We have unintentionally
also disabled the behavior on content nodes, i.e. on any clusters which
do not use data tiers. With this commit we explicitly exclude content
nodes from the heuristic so they can benefit from speedups due to
concurrent mgets.

Relates elastic#103061
  • Loading branch information
danielmitterdorfer committed Jan 22, 2024
1 parent 0bb87db commit f942713
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ static boolean isAnyAssignedToNode(ClusterState state, List<Index> indices, Pred
* @return <code>true</code> iff at least one index is allocated to either a warm or cold data node.
*/
static boolean isAnyOnWarmOrColdTier(ClusterState state, List<Index> indices) {
return isAnyAssignedToNode(state, indices, n -> DataTier.isWarmNode(n) || DataTier.isColdNode(n));
return isAnyAssignedToNode(
state,
indices,
// a content node is never considered a warm or cold node
n -> DataTier.isContentNode(n) == false && (DataTier.isWarmNode(n) || DataTier.isColdNode(n))
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.UUID;

public class IndexAllocationTests extends ESTestCase {
private final Index content = idx("content");
private final Index hot = idx("hot");
private final Index warm = idx("warm");
private final Index cold = idx("cold");
Expand All @@ -49,6 +50,10 @@ public void testOtherIndicesNotOnWarmColdTier() {
assertFalse(IndexAllocation.isAnyOnWarmOrColdTier(clusterState(), List.of(hot, frozen)));
}

public void testIndicesOnContentNodeNotOnWarmColdTier() {
assertFalse(IndexAllocation.isAnyOnWarmOrColdTier(clusterState(), List.of(content)));
}

public void testIndicesOnWarmColdTier() {
assertTrue(IndexAllocation.isAnyOnWarmOrColdTier(clusterState(), List.of(warm)));
assertTrue(IndexAllocation.isAnyOnWarmOrColdTier(clusterState(), List.of(cold)));
Expand All @@ -73,6 +78,20 @@ private ClusterState clusterState() {
DiscoveryNode node = DiscoveryNodeUtils.create("node");
DiscoveryNodes.Builder nodesBuilder = DiscoveryNodes.builder().localNodeId("node").masterNodeId("node").add(node);

nodesBuilder.add(
DiscoveryNodeUtils.builder("n-" + content.getName())
.roles(
Set.of(
// content nodes have all roles
DiscoveryNodeRole.DATA_CONTENT_NODE_ROLE,
DiscoveryNodeRole.DATA_HOT_NODE_ROLE,
DiscoveryNodeRole.DATA_WARM_NODE_ROLE,
DiscoveryNodeRole.DATA_COLD_NODE_ROLE,
DiscoveryNodeRole.DATA_FROZEN_NODE_ROLE
)
)
.build()
);
nodesBuilder.add(DiscoveryNodeUtils.builder("n-" + hot.getName()).roles(Set.of(DiscoveryNodeRole.DATA_HOT_NODE_ROLE)).build());
nodesBuilder.add(DiscoveryNodeUtils.builder("n-" + warm.getName()).roles(Set.of(DiscoveryNodeRole.DATA_WARM_NODE_ROLE)).build());
nodesBuilder.add(DiscoveryNodeUtils.builder("n-" + cold.getName()).roles(Set.of(DiscoveryNodeRole.DATA_COLD_NODE_ROLE)).build());
Expand All @@ -82,7 +101,7 @@ private ClusterState clusterState() {

RoutingTable.Builder routingTableBuilder = RoutingTable.builder();
Map<String, IndexMetadata> indices = new HashMap<>();
for (Index index : List.of(hot, warm, cold, frozen)) {
for (Index index : List.of(content, hot, warm, cold, frozen)) {
indices.put(index.getName(), metadata(index));
ShardRouting shardRouting = ShardRouting.newUnassigned(
new ShardId(index, 0),
Expand Down

0 comments on commit f942713

Please sign in to comment.