DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Zero-Latency Data Analytics for Modern PostgreSQL Applications
  • Required Knowledge To Pass AWS Certified Data Analytics Specialty Exam
  • Google Cloud KMS vs. AWS KMS: Java Encryption Guide
  • Multi-Agent Orchestration on AWS With AgentCore Runtime and A2A

Trending

  • Designing the Runtime Layer for Stateful AI Agents: Where Agent Substrate Fits
  • How to Hide Sensitive Information Before You Share a File
  • AI-Powered CI Test Failure Triage
  • From Issue to Reviewable Patch: Build a Sandboxed Coding Agent With Deep Agents and Automated Tests

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Data Engineering
  3. Databases
  4. Amazon Redshift Workload Management (WLM): A Step-by-Step Guide

Amazon Redshift Workload Management (WLM): A Step-by-Step Guide

Amazon Redshift's WLM feature lets you define how queries are prioritized and resources are allocated. This guide walks through setting up WLM step by step.

By 
arvind toorpu
DZone Core CORE ·
Oct. 14, 24 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
3.5K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

As a database administrator or data engineer working with Amazon Redshift, it's crucial to manage resources effectively to handle different workloads. Amazon Redshift's Workload Management (WLM) feature lets you define how queries are prioritized and how resources like CPU and memory are allocated. This guide will walk you through setting up WLM step by step, making it easy for newbies to get started.

What Is Workload Management (WLM)?

WLM allows Amazon Redshift to handle multiple concurrent queries by allocating resources to query queues. You can create custom queues, allocate memory, and set concurrency limits for specific workloads, ensuring that critical queries run efficiently even under heavy loads.


Step-by-Step Setup Guide to Implement WLM

Step 1: Access Amazon Redshift Console

  1. Log in to your AWS Management Console.
  2. In the search bar, type "Redshift" and click on Amazon Redshift.
  3. Navigate to your Redshift cluster. Choose the cluster for which you want to set up WLM.

Step 2: Navigate to Workload Management (WLM) Settings

  1. Once inside your cluster, go to the Properties tab.
  2. Scroll down to Workload Management (WLM) settings.
  3. You'll see the current queues and configurations here.

Redshift WLM Setup

Redshift WLM Setup

Step 3: Switch to Manual WLM (If Necessary)

By default, Redshift uses Automatic WLM, whereas Amazon Redshift handles queue management automatically.

  1. For greater control, switch to Manual WLM.
  2. Click Modify.
  3. Disable Auto WLM and switch to Manual WLM to create custom queues.

Step 4: Define WLM Queues

Now let’s set up custom queues.

Create a New Queue

Click Add Queue. For example, let’s create a queue for Arvind’s Critical Reports. Give it a name, e.g., arvind_critical_queue.

Set the Concurrency level (the number of queries that can run simultaneously in this queue). For critical queries, you might want fewer concurrent queries for better resource allocation. Set Concurrency to 3 for Arvind's queue.

Memory Allocation

Allocate memory for your queue. Amazon Redshift allocates memory as a percentage of the total available memory.

Let’s allocate 30% of the memory to arvind_critical_queue, ensuring that the queries in this queue have enough resources for optimal performance.

Timeout Settings (Optional)

To ensure that queries don’t hang, you can set a Query Timeout. Let’s give queries in arvind_critical_queue a 10-minute timeout (600 seconds).

Step 5: Create Additional Queues (Optional)

You may want to create multiple queues for different workloads. For example:

  • Arvind’s Regular Reports Queue:
 
Concurrency: 5
Memory Allocation: 50%
  Timeout: 15 minutes


  • Arvind’s Ad Hoc Queries Queue:
 
Concurrency: 10
Memory Allocation: 20%
  No Timeout


Step 6: Assign Query Groups to Queues

  1. You can assign specific queries or user groups to specific WLM queues.
  2. Go to the WLM Query Monitoring Rules tab.
  3. Click Add Rule. 

For example, to assign all queries run by arvind_user to the arvind_critical_queue:

 
Set user_group = arvind_user
  Set queue_name = arvind_critical_queue


This ensures that all critical queries by Arvind are run through the appropriate queue, prioritizing them over less important workloads.

User groups, concurrency scaling mode, and query priority selection boxes

Step 7: Save Changes and Monitor

Once you've configured the queues, click Save.

Amazon Redshift will apply the new WLM configuration.

You can monitor the performance of these queues using CloudWatch to track query execution times, memory usage, and concurrency limits.

Example Scenario: How Arvind Manages Daily Reporting Workloads

Let’s say Arvind Toorpu runs several types of queries daily:

  • Critical reports: These queries are run early in the morning to generate business-critical reports. They need top priority and should not be delayed by other workloads. Arvind allocates 30% of memory and limits concurrency to 3 for these.
  • Regular reports: These queries generate regular, less urgent reports, so Arvind allocates 50% of memory and sets concurrency to 5 to allow multiple reports to run simultaneously.
  • Ad hoc queries: These are run sporadically during the day and aren’t time-sensitive. Arvind allocates only 20% of the resources, allowing more queries to run concurrently but with lower priority.

By configuring WLM in this way, Arvind ensures that critical tasks receive the resources they need while allowing flexibility for other workloads.

Final Thoughts

Workload Management (WLM) is a powerful tool in Amazon Redshift that manages multiple types of workloads. By creating queues with appropriate resource allocations and concurrency limits, you can ensure that your system runs efficiently, even under heavy load. For beginners, it's important to start with basic queues and gradually refine them as you better understand your workloads.

With the right setup, you can give priority to the queries that matter most and keep everything running smoothly, just like Arvind does with his daily reports!

AWS Amazon Redshift Database administrator

Published at DZone with permission of arvind toorpu. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Zero-Latency Data Analytics for Modern PostgreSQL Applications
  • Required Knowledge To Pass AWS Certified Data Analytics Specialty Exam
  • Google Cloud KMS vs. AWS KMS: Java Encryption Guide
  • Multi-Agent Orchestration on AWS With AgentCore Runtime and A2A

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook