As data analytics use cases grow, factors of scalability and concurrency become crucial for businesses. Your analytic solution architecture should be able to handle large data volumes at high concurrency and without compromising speed, thereby delivering a scalable high-performance analytics environment.
Amazon Redshift Serverless provides a fully managed, petabyte-scale, auto scaling cloud data warehouse to support high-concurrency analytics. It offers data analysts, developers, and scientists a fast, flexible analytic environment to gain insights from their data with optimal price-performance. Redshift Serverless auto scales during usage spikes, enabling enterprises to cost-effectively help meet changing business demands. You can benefit from this simplicity without changing your existing analytics and business intelligence (BI) applications.
To help meet demanding performance needs like high concurrency, usage spikes, and fast query response times while optimizing costs, this post proposes using Redshift Serverless. The proposed solution aims to address three key performance requirements:
The suggested architecture uses multiple Redshift Serverless endpoints accessed through a single Network Load Balancer client endpoint. The Network Load Balancer evenly distributes incoming requests across workgroups. This improves performance and reduces latency by scaling out resources to meet high throughput and low latency demands.
Solution overview The following diagram outlines a Redshift Serverless architecture with multiple Amazon Redshift managed VPC endpoints behind a Network Load Balancer.
The following are the main components of this architecture:
Create an Amazon Redshift managed VPC endpoint Complete the following steps to create the Amazon Redshift managed VPC endpoint:
The following screenshot shows an example of this workgroup. Note down the IP address to use during the creation of the target group.
Repeat these steps to create all your Redshift Serverless workgroups.
Add VPC endpoints for the target group for the Network Load Balancer To add these VPC endpoints to the target group for the Network Load Balancer using Amazon Elastic Compute Cloud (Amazon EC2), complete the following steps:
Create a load balancer After you create the target group, you can create your load balancer. We recommend using port 5439 (Amazon Redshift default port) for it.
The Network Load Balancer serves as a single-access endpoint and will be used on connections to reach Amazon Redshift. This allows you to add more Redshift Serverless workgroups and increase the concurrency transparently.
Testing the solution We tested this architecture to run three BI reports with the TPC-DS dataset (cloud benchmark dataset) as our data. Amazon Redshift includes this dataset for free when you choose to load sample data (sample_data_dev database). The installation also provides the queries to test the setup.
Among all the queries from TPC-DS benchmark, we chose the following three to use as our report queries. We changed the first two report queries to use a CREATE TABLE AS SELECT (CTAS) query on temporary tables instead of the WITH clause to emulate options you can see on a typical BI tool. For our testing, we also disabled the result cache to make sure that Amazon Redshift would run the queries every time.
The set of queries contains the creation of temporary tables, a join between those tables, and the cleanup. The cleanup step drops tables. This isn’t needed because they’re deleted at the end of the session, but this aims to simulate all that the BI tool does.
We used Apache JMETER to simulate clients invoking the requests. To learn more about how to use and configure Apache JMETER with Amazon Redshift, refer to Building high-quality benchmark tests for Amazon Redshift using Apache JMeter.
For the tests, we used the following configurations:
We tested three reports by spawning 100 sessions per report (300 total). There were 14 statements across the three reports (4,200 total). All sessions were triggered simultaneously.
The following table summarizes the tables used in the test.
| Table Name | Row Count | | Catalog_page | 93,744 | | Catalog_sales | 23,064,768 | | Customer_address | 50,000 | | Customer | 100,000 | | Date_dim | 73,049 | | Item | 144,000 | | Promotion | 2,400 | | Store_returns | 4,600,224 | | Store_sales | 46,086,464 | | Store | 96 | | Web_returns | 1,148,208 | | Web_sales | 11,510,144 | | Web_site | 240 |
Some tables were modified by ingesting more data than what the TPC-DS schema offers on Amazon Redshift. Data was reinserted on the table to increase the size.
Test results The following table summarizes our test results.
| TEST 1 | . | Time Consumed | Number of Queries | Cost | Max Scaled RPU | Performance | | Single: 96 RPUs | 0:02:06 | 2,100 | $6 | 279 | Base | | Parallel: 3x 32 RPUs | 0:01:06 | 2,100 | $1.20 | 96 | 48.03% | | Parallel 1 (32 RPU) | 0:01:03 | 688 | $0.40 | 32 | 50.10% | | Parallel 2 (32 RPU) | 0:01:03 | 703 | $0.40 | 32 | 50.13% | | Parallel 3 (32 RPU) | 0:01:06 | 709 | $0.40 | 32 | 48.03% | | TEST 2 | . | Time Consumed | Number of Queries | Cost | Max Scaled RPU | Performance | | Single: 48 RPUs | 0:01:55 | 2,100 | $3.30 | 168 | Base | | Parallel: 3x 16 RPUs | 0:01:47 | 2,100 | $1.90 | 96 | 6.77% | | Parallel 1 (16 RPU) | 0:01:47 | 712 | $0.70 | 36 | 6.77% | | Parallel 2 (16 RPU) | 0:01:44 | 696 | $0.50 | 25 | 9.13% | | Parallel 3 (16 RPU) | 0:01:46 | 692 | $0.70 | 35 | 7.79% |
The preceding table shows that the parallel setup was faster than the single at a lower cost. Also, in our tests, even though Test 1 had double the capacity of Test 2 for the parallel setup, the cost was still 36% lower and the speed was 39% faster. Based on these results, we can conclude that for workloads that have high throughput (I/O), low latency, and high concurrency requirements, this architecture is cost-efficient and performant. Refer to the AWS Pricing Cost Calculator for Network Load Balancer and VPC endpoints pricing.
Redshift Serverless automatically scales the capacity to deliver optimal performance during periods of peak workloads including spikes in concurrency of the workload. This is evident from the maximum scaled RPU results in the preceding table.
Recently released features of Redshift Serverless such as MaxRPU and AI-driven scaling were not used for this test. These new features can increase the price-performance of the workload even further.
We recommend enabling cross-zone load balancing on the Network Load Balancer because it distributes requests from clients to registered targets. Enabling cross-zone load balancing will help balance the requests among the Redshift Serverless managed VPC endpoints irrespective of the Availability Zone they are configured in. Also, if the Network Load Balancer receives traffic from only one server (same IP), you should always use an odd number of Redshift Serverless managed VPC endpoints behind the Network Load Balancer.
Conclusion In this post, we discussed a scalable architecture that increases the throughput of Redshift Serverless in low latency, high concurrency scenarios. Having multiple Redshift Serverless workgroups behind a Network Load Balancer can deliver a horizontally scalable solution at the best price-performance.
Additionally, Redshift Serverless uses AI techniques (currently in preview) to scale automatically with workload changes across all key dimensions—such as data volume changes, concurrent users, and query complexity—to meet and maintain your price-performance targets.
We hope this post provides you with valuable guidance. We welcome any thoughts or questions in the comments section.
About the Authors Ricardo Serafim is a Senior Analytics Specialist Solutions Architect at AWS.
Harshida Patel is a Analytics Specialist Principal Solutions Architect, with AWS.
Urvish Shah is a Senior Database Engineer at Amazon Redshift. He has more than a decade of experience working on databases, data warehousing and in analytics space. Outside of work, he enjoys cooking, travelling and spending time with his daughter.
Amol Gaikaiwari is a Sr. Redshift Specialist focused on helping customers realize their business outcomes with optimal Redshift price-performance. He loves to simplify data pipelines and enhance capabilities through adoption of latest Redshift features.