Skip to content

Choosing between smaller node-type higher node-count cluster vs larger node-type lower node-count cluster for Amazon Redshift provisioned.

4 minute read
Content level: Advanced
0

Amazon Redshift RG node type offers multiple node sizes: rg.large, rg.xlarge, rg.4xlarge and also rg.12xlarge. This article will guide you towards choosing smaller or larger node type.

Lets use 6-node rg.4xlarge and 2-node rg.12xlarge as examples for this article. The 12xl node type is three times bigger than the 4xl node type. It provides three times the compute resources and is priced also three times the 4xl. Below table shows On-demand Per Hour price in us-east-1 region.

Node TypeNode PriceNode vCPUNode vRAMCluster Node CountCluster Total vCPUCluster Total vRAMCluster Total Price
rg.4xl$3.04316128696768$18.26
rg.12xl$9.12848384296768$18.26

So how should one choose between the two options for creating their cluster. The answer lies hidden in understanding the Amazon Redshift query plan.

JoinPerformance

  • Higher data redistribution in query execution leads to higher inter-node traffic.
  • Lowering the node count, reduces the total inter-node traffic because data needs to shuffled between just 2-nodes instead of 6-nodes.
  • Larger node type cluster comes with a larger leader node, providing better performance of leader node tasks.

It is expected that you have followed Amazon Redshift best practices for designing tables and designing queries but still you are seeing queries are shuffling data between nodes. One of the main reasons is intermediate tables that get created during query execution need to be sent over to other nodes, and these intermediate tables might not always be in your control. For your most important and repeated complex queries you can break down complex logic into multi-step queries and create one or more physical tables. But we have to acknowledge that this is not viable every time, and can be done only so many times. After which you have to rely on raw compute power.

Use below SQL to gather data for your warehouse queries join patterns

with base as (
select 
    sum(case when plan_node like '%DS_DIST_NONE%' then 1 else 0 end) as DS_DIST_NONE_CNT,
    sum(case when plan_node like '%DS_DIST_ALL_NONE%' then 1 else 0 end) as DS_DIST_ALL_NONE_CNT,
    sum(case when plan_node like '%DS_DIST_INNER%' then 1 else 0 end) as DS_DIST_INNER_CNT,
    sum(case when plan_node like '%DS_DIST_OUTER%' then 1 else 0 end) as DS_DIST_OUTER_CNT,
    sum(case when plan_node like '%DS_BCAST_INNER%' then 1 else 0 end) as DS_BAST_INNER_CNT,
    sum(case when plan_node like '%DS_DIST_ALL_INNER%' then 1 else 0 end) as DS_DIST_ALL_INNER_CNT,
    sum(case when plan_node like '%DS_DIST_BOTH%' then 1 else 0 end) as DS_DIST_BOTH_CNT,
    sum(case when plan_node like '%DS_DIST_ERR%' then 1 else 0 end) as DS_DIST_ERR_CNT,
    DS_DIST_NONE_CNT+DS_DIST_ALL_NONE_CNT+DS_DIST_INNER_CNT+DS_DIST_OUTER_CNT+
    DS_BAST_INNER_CNT+DS_DIST_ALL_INNER_CNT+DS_DIST_BOTH_CNT+DS_DIST_ERR_CNT as total
from 
    SYS_QUERY_EXPLAIN
)
select 
    round(DS_DIST_NONE_CNT*100/TOTAL::FLOAT4,2) as DS_DIST_NONE_perc,
    round(DS_DIST_ALL_NONE_CNT*100/total::FLOAT4,2) as DS_DIST_ALL_NONE_perc,
    round(DS_DIST_INNER_CNT*100/total::FLOAT4,2) as DS_DIST_INNER_perc,
    round(DS_DIST_OUTER_CNT*100/total::FLOAT4,2) as DS_DIST_OUTER_perc,
    round(DS_BAST_INNER_CNT*100/total::FLOAT4,2) as DS_BAST_INNER_perc,
    round(DS_DIST_ALL_INNER_CNT*100/total::FLOAT4,2) as DS_DIST_ALL_INNER_perc,
    round(DS_DIST_BOTH_CNT*100/total::FLOAT4,2) as DS_DIST_BOTH_perc,
    round(DS_DIST_ERR_CNT*100/total::FLOAT4,2) as DS_DIST_ERR_perc
from base 
  • Majority of the warehouses exhibit 1 through 7, mixed workloads, variety of queries, multiple use cases and projects are being served.
  • Only hyper-tuned single-purpose warehouses exhibit only 1 & 2 from above. These warehouses only run highly repeated well-tuned queries.
  • If 90% or more of your queries fall into 1 through 4 then you can go with smaller node-type higher node-count cluster.
  • Smaller node type cluster gives option to increase the cluster size in smaller increments than larger node type cluster.
  • If greater than 20% of your queries exhibit 5 through 7 then cluster with larger node-type and lower node-count will give you better performance.

If you are just starting your project and do not have any data to check the explain plan for then Amazon Redshift console provides you a Help me choose widget. This can recommend a cluster configuration based on the total data volume and amount of data you expect to typically query. This widget is great for a start but it does not take into account the number of queries being executed concurrently or query complexity, which are often the most influential factors for performance. So you might need to go 2x or 4x or x/2 or x/4 from this initial sizing recommendation.

Execute your workloads till a Production representative data is available to analyze. Do enable System table integration with S3 Tables, else you will be limited to only 7 days of system tables to analyze.

Also remember to re-evaluate your warehouse join patterns periodically. Over time your warehouse workload will change as users, projects, teams, use-cases naturally evolve over time.

AWS
EXPERT

published 7 days ago96 views