Microsoft Azure SQL Data Warehouse Quick Review and Amazon Redshift Comparison – Part 1

Note: Part 2 can be found HERE and code files downloaded from HERE

Introduction

Last time I wrote about cloud-enabled data warehousing (see the 3-part series starting HERE), only one vendor and product qualify as a truly enterprise PaaS offering – Amazon Redshift running on AWS. Yes, there were other providers coming out of the woodwork, boasting their readiness to take on this juggernaut of cloud computing e.g. Bityota (already acquired by LifeLock) or SnowflakeDB (headed by a former Microsoft executive Bob Muglia) but none of them made it past the TechCrunch mention deep into the CxO’s wallets and capitalized on the data boom. Microsoft has been touting their Azure Data Warehouse as a formidable competitor to Redshift since mid-2015, with a host of features that may appeal to spending-cautious departments making their first foray into the cloud. In addition to competing on price, Microsoft also strives to differentiate itself with several features that Redshift does not offer. Some distinctive characteristics that separate Azure Data Warehouse from Redshift are:

  • Wide support of SQL and integration with other services – The SQL Data Warehouse extends the T-SQL constructs most developers are already familiar with to create indexes, partitions and stored procedures, which allow for an easy migration to the cloud. With native integration with Azure Data Factory, Azure Machine Learning and Power BI, Microsoft claims that customers are able to quickly ingest data, utilize learning algorithms, and visualize data born either in the cloud or on-premises
  • Separating compute and storage with ability to pause an instance – Azure SQL Data Warehouse independently scales compute and storage so customers only pay for the query performance they need. Dynamic pause enables businesses to optimize the utilization of the compute infrastructure by ramping down compute while persisting the data with no need to back up the data, delete the existing cluster, and, upon resume, generate a new cluster and restore data
  • PolyBase for structured and unstructured data blending – SQL Data Warehouse can query unstructured and semi-structured data stored in Azure Storage, Hortonworks Data Platform, or Cloudera using familiar T-SQL skills
  • Hybrid infrastructure for supporting on-premises and/or in the cloud

At its core, SQL Data Warehouse uses Microsoft’s massive parallel processing (MPP) architecture, originally designed to run some of the largest on-premises enterprise data warehouses. This architecture takes advantage of built-in data warehousing performance improvements and also allows SQL Data Warehouse to easily scale-out and parallelize computation of complex SQL queries. In addition, SQL Data Warehouse’s architecture is designed to take advantage of its presence in Azure. Combining these two aspects, the architecture breaks up into 4 key components:

  • Control node: You connect to the Control node when using SQL Data Warehouse with any development, loading, or business intelligence tools. In SQL Data Warehouse, the Control node is a SQL Database, and connecting it looks and feels like a standard SQL Database. However, under the surface, it coordinates all of the data movement and computation that takes place in the system. When a command is issued to the Control node, it breaks it down into a set of queries that will be passed onto the compute nodes of the service
  • Compute Nodes: Like the control node, the compute nodes of SQL Data Warehouse are powered using SQL Databases. Their job is to serve as the compute power of the service. Behind the scenes, any time data is loaded into SQL Data Warehouse, it is distributed across the nodes of the service. Then, any time the control node receives a command it breaks it into pieces for each compute node, and the compute nodes operate over their corresponding data. After completing their computation, compute nodes pass partial results to the control node which then aggregates results before returning an answer
  • Storage: All storage for SQL Data Warehouse is standard Azure Storage Blobs. This means that when interacting with data, compute nodes are writing and reading directly to/from Blobs. Azure Storage’s ability to expand transparently and nearly limitlessly allows us to automatically scale storage, and to do so separately from compute. Azure Storage also allows us to persist storage while scaling or paused, streamline our back-up and restore process, and have safer, more fault tolerant storage
  • Data Movement Services: The final piece holding everything together in SQL Data Warehouse is our Data Movement Services. The data movement services allows the control node to communicate and pass data to all of the compute nodes. It also enables the compute nodes to pass data between each other, which gives them access to data on other compute nodes, and allows them to get the data that they need to complete joins and aggregations

Azure_SQL_DW_Review_SQLDW_Architecture_Overview

Microsoft provides a good intro into Azure Data Warehouse which outlines all of the above features and more in the video below.

All features and fancy bells and whistles aside, a typical business would also be interested in what sort of performance per dollar Microsoft’s offering would bring to the table as well as the level of integration the product can provide. As indicated in my previous post on AWS Redshift, building an enterprise data warehouse is a very costly and time-intensive activity regardless of which vendor or technology one chooses to peruse. In most if not all cases performance consideration would only constitute a fraction of the overall project plan so performance statistics alone should not become the sole merit on the technology choice, especially when coupled with a paradigm-shifting data warehouse architecture like the cloud computing. With that in mind, query execution speed is one of the most basic and fastest way of testing vendor offering and in this post I will provide a rudimentary analysis of the query execution speed based on Amazon’s TICKIT database which I used for my Redshift review a while ago and try to compare and contrast Azure Data Warehouse (preview edition) with the AWS equivalent based on predefined price/performance points. I would also like to briefly touch on Azure Data Warehouse integration with other vendors/partners, manly from analytical and reporting angle e.g. connecting from and analyzing the data in Tableau and Microsoft Power BI.

Pricing Overview

In case of Azure Data Warehouse Compute and Storage are billed separately. Compute usage is represented with DWU (Data Warehouse Unit) and customers can scale up and down the level of performance/DWUs they need by 100 DWU blocks. The preview price for the compute is USD 1.03/hr (~$766/mo) capped at 2000 DWU. When it comes to storage, Azure distinguishes between four types – Block blobs, Page Blobs and Disks, Tables and Queues, and Files, where total cost depends on how much you store, the volume of storage transactions and outbound data transfers, and which data redundancy option you choose. For Azure Data Warehouse, storage rates are based on standard RA-GRS Page Blob rates and cost around $0.1529 per GB (First 1 TB / Month).

Microsoft is still quite clandestine about the actual hardware used to power Azure Data Warehouse, presumably due to the fact that it is still in a preview mode. The DWU – the unit of performance/cost that is used to scale processing capabilities is pretty much the only variable one can adjust to increase/decrease performance/price, which is not necessarily a bad thing – rather than choosing from a myriad of hardware configuration options I’d much rather select a unit of computational capability tied to a specific cost corresponding to the prospective workload. Quoting Microsoft here, ‘A DWU represents the power of the query performance and is quantified by workload objectives: how fast rows are scanned, loaded, and copied’. A bit cloak and dagger but simple and straightforward at the same time. Having said that, when attending one of Microsoft session at the Ignite conference in Gold Coast, Australia, Microsoft representative reluctantly stated that the closest hardware specifications equivalent of 100 DTU would equate to roughly one compute unit i.e. 6 cores and 48GB of memory. Again, this is at the time of publishing this post so these provisions will most likely scale up as updated version gets released. Besides, I can only see abstracting physical hardware capacity as a good thing – all I really want to do is to be as declarative as possible and tell the vendor how high (and how economically) I want them to jump and they do it, without having to worry about how it all ‘hangs together’ at the back end. Isn’t that the beauty of cloud computing after all? The image below is the only things I could find that provides a rough description of how DTU selection affects performance levels.

Azure_SQL_DW_Review_DTU_Measure

Amazon, on the other hand, provides a very high-level outline of some of the key features tied to individual service e.g. I/O speed for the direct-attached storage or memory size. Below is the outline of the instance classes and related parameters I used for query performance testing between individual service types. Below table outlines the ‘testbed’ configurations I used to measure SQL execution performance on both services.

Azure_SQL_DW_Review_Test_Instances_Specs

Provisioning both services could not be any simpler, in both vendors’ case it’s just a matter of selecting the desired computing capacity with its associated cost, deciding on the naming conventions for the designated servers and databases and finally configuring firewall to allow client access. In case of Azure I stumbled across a small issue when deploying the instance ‘got stuck’ on ‘In Progress’ status for over 19 hours, with no details provided by the portal on why the deployment was taking so long (see image below). Selecting a different region (initial region allocation for Azure DW deployment was Australia Southeast) seemed to rectify the problem but I wish Azure provided more information when roadblocks like this one occur, other than just a progress bar and a sparse message.

Azure_SQL_DW_Review_Extended_Provisioning_Time

Test Data and Load

So what is Azure Data Warehouse performance like in comparison to the Amazon Redshift equivalent? To answer this question, first I needed to expand on the data provided by Amazon (TICKIT database) and copy it across to both services. This sample database helps analysts track sales activity for the fictional TICKIT web site, where users buy and sell tickets online for sporting events, shows, and concerts. In particular, analysts can identify ticket movement over time, success rates for sellers, and the best-selling events, venues, and seasons. Analysts can use this information to provide incentives to buyers and sellers who frequent the site, to attract new users, and to drive advertising and promotions. TICKIT database consists of seven tables: two fact tables and five dimensions as per the schema below.

Azure_SQL_DW_Review_TICKIT_db_schema_ERD

Given the fact that there was not nearly enough data in the flat files provided (you can download text files used for this exercise from HERE) I needed a way to ‘grow’ the main fact table dataset to a more respectable size. The script I used for this purpose (saved in my OneDriver folder HERE) simply creates tables schema, inserts flat files data into the newly created database and ‘stretches out’ the main fact table into 50,000,000 rows. The last section also replaces the original sales comma delimited file with a series of files generated after sales table data expansion, each holding just over 5,000,000 records. This is to facilitate subsequent data import where smaller files are more ‘predictable’ and easier to manage when loading over the network. These 10 files containing sales data, in conjunction with the remaining dimensional data files, will form the basis for my quick query execution analysis.

Loading data into both services is a straightforward affair. In case of Redshift I used the same method as last time (see my previous blog post HERE) i.e. using Amazon’s recommended COPY utility to move text files across from S3 bucket into Redshift. There are other ways to do it but since this approach worked really well for me last time I decided to stick with the tried and tested methodology.

SQL Data Warehouse presents numerous options for loading data including PolyBase, Azure Data Factory, BCP command-line utility, SQL Server Integration Services (SSIS) as well as 3rd party data loading tools.  Each method comes with its own pros and cons. Below are the slide deck shots from the Gold Coast Microsoft Ignite conference presentation roughly outlining key advantages/disadvantages and features characterizing those approaches.

Azure_SQL_DW_Review_Data_Load_Technique_1

Azure_SQL_DW_Review_Data_Load_Technique_2

Azure_SQL_DW_Review_Data_Load_Technique_3

The following table details the results of four separate Azure SQL Data Warehouse load tests using PolyBase, BCP, SQLBulkCopy/ADF and SSIS.

Azure_SQL_DW_Review_Data_Load_Performance

As you can see, the PolyBase method shows a significantly higher throughput rate compared to BCP, SQLBulkCopy, and SSIS Control-node client gated load methods. If PolyBase is not an option, however, BCP provides the next best load rate. Regarding loads that improved based on concurrent load (the third row in the chart), keep in mind that SQL Data Warehouse supports up to 32 concurrent queries (loads).

For this demo BCP looked like the most straightforward way to populate TICKIT database schema so I settled for the BCP utility. To partially automate BCP execution for each table I have deployed a simple batch file script (see code below) which, apart from loading the data from flat files, also creates TestDW database schema via a range of DDL statements being sourced from a SQL file, checks for record count discrepancies, and finally creates clustered columnstore indexes and statistics on all tables. If using it, just ensure that parameters highlighted have been populated with values corresponding to your environment and as always, this code, along with other scripts, can be downloaded from my OneDrive folder HERE.

REM TICKIT Database Objects Definition, Data Load and Stats Refresh Job

@echo off

REM ============================
REM Start User Defined Variables
REM ============================

set server=
set user=
set password=
set database=

REM ==========================
REM End User Defined Variables
REM ==========================

set tables=Users, Venue, Category, Date, Event, Listing, Sales
set views=vstats_columns
set storedprocs=prc_sqldw_create_stats
set ddl=tickit_ddl.sql
set validation=tickit_check.sql
set idxs_and_statistics=tickit_create_idxs_and_statistics.sql
set schema=dbo
set p1=.
set logs=%p1%\logs
set load="C:\Program Files\Microsoft SQL Server\110\Tools\Binn\bcp.exe"
set mode=reload
set login_timeout=120

mkdir %logs% 2> nul
del %logs%\*.log 2> nul

if "%server%"=="" (
    echo %date% %time% Server needs to be specified.
    goto eof
)

if "%user%"=="" (
    echo %date% %time% User needs to be specified.
    goto eof
)

if "%password%"=="" (
    echo %date% %time% Password needs to be specified.
    goto eof
)

if "%database%"=="" (
    echo %date% %time% Database needs to be specified.
    goto eof
)

if not exist %load% (
    echo %date% %time% Bcp must be installed.
    goto eof
)

echo %date% %time% Dropping Existing TICKIT Tables, Views and Stored Procedures

for %%t in (%tables%) do (
    sqlcmd -S "%server%" -U %user% -P %password% -d %database% -I -l %login_timeout% -e -Q "IF EXISTS (SELECT NULL FROM sys.tables WHERE name = '%%t') DROP TABLE %%t" >> %logs%\drop_tables.log
)

for %%v in (%views%) do (
    sqlcmd -S "%server%" -U %user% -P %password% -d %database% -I -l %login_timeout% -e -Q "IF EXISTS (SELECT NULL FROM sys.views WHERE name = '%%v') DROP VIEW %%v" >> %logs%\drop_views.log
)

for %%s in (%storedprocs%) do (
    sqlcmd -S "%server%" -U %user% -P %password% -d %database% -I -l %login_timeout% -e -Q "IF EXISTS (SELECT NULL FROM sys.objects WHERE type = 'P' AND OBJECT_ID = OBJECT_ID('%%s')) DROP PROCEDURE %%s" >> %logs%\drop_stored_procs.log
)

echo %date% %time% Existing TICKIT Tables and Views Dropped

echo %date% %time% Creating TICKIT Tables and Views

sqlcmd -S "%server%" -U %user% -P %password% -d %database% -I -i %p1%\%ddl% -l %login_timeout% -b -e >> %logs%\ddl.log

if %ERRORLEVEL% NEQ 0 (
   echo %date% %time% Create DDL statement failed. Please look at the file %output_file% for errors.
   goto eof
)

echo %date% %time% TICKIT Tables and Views Created

echo %date% %time% Loading TICKIT Tables

for %%x in (%tables%) do (

    @echo on
    echo. >> %logs%\loads.log
    echo %date% %time% Loading %%x >> %logs%\loads.log

    IF "%%x"=="Sales" (
	%load% %schema%.%%x in "%p1%\NewSales1.txt" -S%server%  -U%user% -P%password% -d%database% -q -c -t  "|" >> %logs%\loads.log
	%load% %schema%.%%x in "%p1%\NewSales2.txt" -S%server%  -U%user% -P%password% -d%database% -q -c -t  "|" >> %logs%\loads.log
	%load% %schema%.%%x in "%p1%\NewSales3.txt" -S%server%  -U%user% -P%password% -d%database% -q -c -t  "|" >> %logs%\loads.log
	%load% %schema%.%%x in "%p1%\NewSales4.txt" -S%server%  -U%user% -P%password% -d%database% -q -c -t  "|" >> %logs%\loads.log
	%load% %schema%.%%x in "%p1%\NewSales5.txt" -S%server%  -U%user% -P%password% -d%database% -q -c -t  "|" >> %logs%\loads.log
	%load% %schema%.%%x in "%p1%\NewSales6.txt" -S%server%  -U%user% -P%password% -d%database% -q -c -t  "|" >> %logs%\loads.log
	%load% %schema%.%%x in "%p1%\NewSales7.txt" -S%server%  -U%user% -P%password% -d%database% -q -c -t  "|" >> %logs%\loads.log
	%load% %schema%.%%x in "%p1%\NewSales8.txt" -S%server%  -U%user% -P%password% -d%database% -q -c -t  "|" >> %logs%\loads.log
	%load% %schema%.%%x in "%p1%\NewSales9.txt" -S%server%  -U%user% -P%password% -d%database% -q -c -t  "|" >> %logs%\loads.log
	%load% %schema%.%%x in "%p1%\NewSales10.txt" -S%server%  -U%user% -P%password% -d%database% -q -c -t  "|" >> %logs%\loads.log
    ) ELSE (
    	%load% %schema%.%%x in "%p1%\%%x.txt" -S%server%  -U%user% -P%password% -d%database% -q -c -t  "|" >> %logs%\loads.log
	)
    @echo off

    if %ERRORLEVEL% NEQ 0 (
         echo %date% %time% Load for table %%x failed. Please look at the file %logs%\load_%%x.log for errors.
    ) ELSE (
          echo %date% %time% Table %%x loaded
    )

)

echo %date% %time% TICKIT Tables Loaded

echo %date% %time% Validating Row Counts
sqlcmd -S "%server%" -U %user% -P %password% -d %database% -I -i %p1%\%validation% -l %login_timeout%

echo %date% %time% Creating Clustered ColumStore Indexes and Statistics on all Tables
sqlcmd -S "%server%" -U %user% -P %password% -d %database% -I -i %p1%\%idxs_and_statistics% -l %login_timeout% -e -p >> %logs%\idxs_and_statistics.log
echo %date% %time% ColumnStore Indexes and Statistics Created on all Tables

:eof

Alternatively, providing you have already created all necessary tables on your DW instance, you can simply copy and paste the following ‘one-liners’ into your command prompt, adjusting files location, server name, database name and credentials parameters to match your environment.

bcp Users in c:\Tickit_Extended_DB_Files\users.txt -S <Server Name> -d <Database Name> -U <Username> -P <password> -q -c -t "|"
bcp Venue in c:\Tickit_Extended_DB_Files\venue.txt -S <Server Name> -d <Database Name> -U <Username> -P <password> -q -c -t  "|"
bcp Category in c:\Tickit_Extended_DB_Files\category.txt -S <Server Name> -d <Database Name> -U <Username> -P <password> -q -c -t  "|"
bcp Date in c:\Tickit_Extended_DB_Files\date.txt -S <Server Name> -d <Database Name> -U <Username> -P <password> -q -c -t  "|"
bcp Event in c:\Tickit_Extended_DB_Files\event.txt -S <Server Name> -d <Database Name> -U <Username> -P <password> -q -c -t  "|"
bcp Listing in c:\Tickit_Extended_DB_Files\listing.txt -S <Server Name> -d <Database Name> -U <Username> -P <password> -q -c -t  "|"
bcp Sales in c:\Tickit_Extended_DB_Files\NewSales1.txt -S <Server Name> -d <Database Name> -U <Username> -P <password> -q -c -t  "|"
bcp Sales in c:\Tickit_Extended_DB_Files\NewSales2.txt -S <Server Name> -d <Database Name> -U <Username> -P <password> -q -c -t  "|"
bcp Sales in c:\Tickit_Extended_DB_Files\NewSales3.txt -S <Server Name> -d <Database Name> -U <Username> -P <password> -q -c -t  "|"
bcp Sales in c:\Tickit_Extended_DB_Files\NewSales4.txt -S <Server Name> -d <Database Name> -U <Username> -P <password> -q -c -t  "|"
bcp Sales in c:\Tickit_Extended_DB_Files\NewSales5.txt -S <Server Name> -d <Database Name> -U <Username> -P <password> -q -c -t  "|"
bcp Sales in c:\Tickit_Extended_DB_Files\NewSales6.txt -S <Server Name> -d <Database Name> -U <Username> -P <password> -q -c -t  "|"
bcp Sales in c:\Tickit_Extended_DB_Files\NewSales7.txt -S <Server Name> -d <Database Name> -U <Username> -P <password> -q -c -t  "|"
bcp Sales in c:\Tickit_Extended_DB_Files\NewSales8.txt -S <Server Name> -d <Database Name> -U <Username> -P <password> -q -c -t  "|"
bcp Sales in c:\Tickit_Extended_DB_Files\NewSales9.txt -S <Server Name> -d <Database Name> -U <Username> -P <password> -q -c -t  "|"
bcp Sales in c:\Tickit_Extended_DB_Files\NewSales10.txt -S <Server Name> -d <Database Name> -U <Username> -P <password> -q -c -t  "|"

It is also worth mentioning that Microsoft provides a handy little utility to create import and export BCP files based on configured set of parameters driven by a wizard-like process. The tool is aptly called Data Warehouse Migration Utility and even though still in preview, it provides an automated schema and data migration scripts generation from SQL Server and Azure SQL Database to Azure SQL Data Warehouse.

Azure_SQL_DW_Review_DW_Migration_Utility

The download link as well as the tool overview page can be found HERE.

In the next post I will provide test results from a selection of sample queries executed on both platforms stacked up against each other and briefly touch on reporting from Azure SQL DW using Power BI and Tableau tools.

http://scuttle.org/bookmarks.php/pass?action=add

Tags: , , ,

This entry was posted on Friday, January 15th, 2016 at 9:47 am and is filed under Azure, Cloud Computing. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply