Use case scenarios for the new SQL Managed Instance Hardware Offerings

Published Nov 02 2021 07:49 AM 909 Views
Microsoft

We want to share with you a couple of scenarios where the workloads benefit from the new hardware offering on Azure SQL Managed Instance. If your workload will benefit from higher memory to CPU vCore ratio, consider the newest hardware offering worth checking out.

 

As you know, at Ignite 2021 Fall we have announced the 2 new Hardware offerings for Azure SQL Managed Instance - Premium series with 7 GB of RAM/vCore and Premium series - Memory Optimized that offer 13.6 GB of RAM/vCore.

 

We do not attempt to list all possible scenarios, but we have chosen the following 2 that some of our SQL Managed Instance customers are facing, once reaching the memory limits of the currently available hardware offerings:

  • Individual Memory Intensive Queries
  • Running many Parallel Queries 

 

Setup

We have taken a TPC-H 300 GB database, where fact tables contain Clustered Columnstore Indexes and are optimized for the Data Warehousing fast data processing. 

We did not change any settings on the SQL Managed Instance itself, using them right ‘out of the box’ after deployment.

We have restored this database backup to our 3 Azure SQL Managed Instances each one using Business Critical service tier with 8 CPU vCores and with 1 TB of Reserved Disk Space – Standard-series, Premium-series and Premium-series Memory-Optimized.

 

Individual Memory Intensive Queries

We have taken one particularly memory intensive TPC-H query and modified it slightly by returning the biggest revenue result and increased the range of data from just 1 year to 20 years, which is a normal amount of data for big Data Warehouse workloads:

 

 

 

SELECT TOP 1
    c_custkey,
    c_name,
    sum(l_extendedprice * (1 - l_discount)) as revenue,
    c_acctbal,
    n_name,
    c_address,
    c_phone,
    c_comment
FROM
    customer,
    orders,
    lineitem,
    nation
WHERE
    c_custkey = o_custkey
    AND l_orderkey = o_orderkey
    AND o_orderdate >= '1993-10-01'
    AND o_orderdate < '2013-10-01' 
    AND l_returnflag = 'R'
    AND c_nationkey = n_nationkey
GROUP BY
    c_custkey,
    c_name,
    c_acctbal,
    c_phone,
    n_name,
    c_address,
    c_comment
ORDER BY
    revenue desc;

 

Running this query on the SQL MI BC Standard-series takes around 49 seconds after warm-up and produces the following execution plan that contains 1 spill operation for the Hash Match inner join operation.

NikoNeugebauer_0-1635805408926.png

The problem is caused by the lack of the available memory. The memory grant that was given for processing the data is 6216 MB, that is by far not enough for this query. It resulted in almost 680.000 pages spill into TempDB, hindering the performance greatly.

 

 

On the SQL MI BC Premium series hadware oferring the situation changes and on the first sight it gets worse, since not just 1 but 2 Hash Match operations are not getting enough memory to execute their operations (Inner Joins & Aggregate), when in reality the execution time lowers to 43 seconds on average.

NikoNeugebauer_2-1635805712773.pngGoing a step deeper uncovers that we have received a 8777 MB memory grant versus the original one 6216 MB fore the Standard series (34% improvement), and that increase resulted in around 475.000 pages spill in TempDB versus the 680.000 pages spill for the Standard series (a 29% improvement) and hence justification for the difference in execution time which itself reflects as 43 seconds vs 49 seconds – meaning a practical 12% improvements in the execution time.

 

By running this query on the SQL MI BC Premium-series Memory-Optimized hardware offering, the first thing you will notice is that it takes just 22 seconds with the following execution plan that suffers no TempDB spilling problems as you can see on the execution plan below:NikoNeugebauer_2-1635806339638.png

The memory grant has been scaled to the whooping 18 GB instead of under 9 GB that was given for the Premium Series, and that amount was enough to process the data without interaction with TempDB – and thus improving the overall performance almost 2 times.

 

 

And on the picture below you can see the overview between the execution differences for each of the selected offerings:

NikoNeugebauer_5-1635806474416.png

 

Running many parallel queries

For the second scenario we have opted to run many parallel queries to see how the SQL MI will behave and process them. To make it simpler, we have chosen another TPC-H based query that we have put inside a Stored Procedure as indicated on the code below:

 

CREATE OR ALTER PROC dbo.GetAnalyticsDemo AS
BEGIN
	SET NOCOUNT ON;

	SELECT 100.00 * sum(case
				when p_type like 'PROMO%'
					then l_extendedprice * (1 - l_discount)
				else 0
			end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue
		FROM
			lineitem,
			part
		WHERE
			l_partkey = p_partkey
			AND l_shipdate >=  '1995-09-01'
			AND l_shipdate < '1995-10-01';
END

 

That was done to simplify the example, given that each of this queries/stored procedures will ask for a Memory Grant of around 3.5 GB of RAM. This allow us to exhaust very fast the available amounts of RAM and respective memory grants for each of the SQL MI instance hardware offerings without going into hundreds of parallel queries.

 

To execute the queries in parallel, we have used the RML Utilities for SQL Server - Update 2021 with a traditional tool for the parallel workload testing - the ostress.

Below is the invocation code that I have used to execute the workload and if you are trying this scenario, please do not forget to substitute the name of the instance, the username and the password to the real ones.

 

ostress -S"MYSUPERMIINSTANCEDEMO.public.123456notvisible.database.windows.net,3342" -Q"EXECUTE TPCH300.dbo.GetAnalyticsDemo;" -n15 -r3 -UsecretUser -PMj3243NGFik234??!@M#

 

For this test we decided to run 15 users in a loop with 3 repetitions, making sure that the queries won't finish right away until I would test them through.


For observing which queries get a memory grant and which one are stuck, I have used the following query, extracting the information from the sys.dm_exec_memory_grants DMV:

 

SELECT sqlt.[text] as QueryText
	  , CAST(((t1.requested_memory_kb)/1024.00) AS DECIMAL(9,2)) RequestedMemoryMB
	  , CAST(((t1.granted_memory_kb)/1024.00) AS DECIMAL(9,2)) GrantedMemoryMB
	  , CAST(((t1.used_memory_kb)/1024.00) AS DECIMAL(9,2)) UsedMemoryMB
	  , CASE WHEN t1.grant_time IS NULL THEN 'Waiting' ELSE 'Granted' END AS RequestStatus
	FROM sys.dm_exec_query_memory_grants t1
		CROSS APPLY sys.dm_exec_sql_text(t1.sql_handle) sqlt
	ORDER BY RequestStatus DESC;

 

On the Standard series hardware offering the picture is quite clear - just 6 out of the 15 queries are getting their memory grants in parallel:

NikoNeugebauer_4-1635808740487.png

 

On the Premium series hardware offering, we observe that the number grows up to 9 queries, meaning we have a potential 50% capacity increase:

NikoNeugebauer_5-1635808961192.png

 

On the Premium series Memory Optimized hardware offering, all queries get the requested memory grants and every process will be able to advance:

NikoNeugebauer_2-1635808363220.png

The key role of operational memory in databases has been always a factor of achieving the highest performance for the memory intensive workloads and the new Hardware offerings for Azure SQL Managed Instance can certainly allow your memory hungry workloads to achieve new heights without scaling up the number of CPU vCores, which is certainly the best solution for the customer.

%3CLINGO-SUB%20id%3D%22lingo-sub-2911126%22%20slang%3D%22en-US%22%3EUse%20case%20scenarios%20for%20the%20new%20SQL%20Managed%20Instance%20Hardware%20Offerings%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2911126%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20want%20to%20share%20with%20you%20a%20couple%20of%20scenarios%20where%20the%20workloads%20benefit%20from%20the%20new%20hardware%20offering%20on%20Azure%20SQL%20Managed%20Instance.%20If%20your%20workload%20will%20benefit%20from%20higher%20memory%20to%20CPU%20vCore%20ratio%2C%20consider%20the%20newest%20hardware%20offering%20worth%20checking%20out.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20you%20know%2C%20at%20Ignite%202021%20Fall%20we%20have%20announced%20the%202%20new%20Hardware%20offerings%20for%20Azure%20SQL%20Managed%20Instance%20-%20%3CSTRONG%3EPremium%20series%3C%2FSTRONG%3E%20with%207%20GB%20of%20RAM%2FvCore%20and%20%3CSTRONG%3EPremium%20series%20-%20Memory%20Optimized%26nbsp%3B%3C%2FSTRONG%3Ethat%20offer%2013.6%20GB%20of%20RAM%2FvCore.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20do%20not%20attempt%20to%20list%20all%20possible%20scenarios%2C%20but%20we%20have%20chosen%20the%20following%202%20that%20some%20of%20our%20SQL%20Managed%20Instance%20customers%20are%20facing%2C%20once%20reaching%20the%20memory%20limits%20of%20the%20currently%20available%20hardware%20offerings%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EIndividual%20Memory%20Intensive%20Queries%3C%2FLI%3E%0A%3CLI%3ERunning%20many%20Parallel%20Queries%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--298975154%22%20id%3D%22toc-hId--298881872%22%3ESetup%3C%2FH2%3E%0A%3CP%3EWe%20have%20taken%20a%20%3CSTRONG%3ETPC-H%20300%20GB%20database%3C%2FSTRONG%3E%2C%20where%20fact%20tables%20contain%20Clustered%20Columnstore%20Indexes%20and%20are%20optimized%20for%20the%20Data%20Warehousing%20fast%20data%20processing.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20did%20not%20change%20any%20settings%20on%20the%20SQL%20Managed%20Instance%20itself%2C%20using%20them%20right%20%E2%80%98out%20of%20the%20box%E2%80%99%20after%20deployment.%3C%2FP%3E%0A%3CP%3EWe%20have%20restored%20this%20database%20backup%20to%20our%203%20Azure%20SQL%20Managed%20Instances%20each%20one%20using%20%3CSTRONG%3EBusiness%20Critical%20service%20tier%3C%2FSTRONG%3E%20with%20%3CSTRONG%3E8%20CPU%20vCores%20and%20with%201%20TB%20of%20Reserved%20Disk%20Space%3C%2FSTRONG%3E%20%E2%80%93%20Standard-series%2C%20Premium-series%20and%20Premium-series%20Memory-Optimized.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--2106429617%22%20id%3D%22toc-hId--2106336335%22%3EIndividual%20Memory%20Intensive%20Queries%3C%2FH2%3E%0A%3CP%3EWe%20have%20taken%20one%20particularly%20memory%20intensive%20TPC-H%20query%20and%20modified%20it%20slightly%20by%20returning%20the%20biggest%20revenue%20result%20and%20increased%20the%20range%20of%20data%20from%20just%201%20year%20to%2020%20years%2C%20which%20is%20a%20normal%20amount%20of%20data%20for%20big%20Data%20Warehouse%20workloads%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3ESELECT%20TOP%201%0A%20%20%20%20c_custkey%2C%0A%20%20%20%20c_name%2C%0A%20%20%20%20sum(l_extendedprice%20*%20(1%20-%20l_discount))%20as%20revenue%2C%0A%20%20%20%20c_acctbal%2C%0A%20%20%20%20n_name%2C%0A%20%20%20%20c_address%2C%0A%20%20%20%20c_phone%2C%0A%20%20%20%20c_comment%0AFROM%0A%20%20%20%20customer%2C%0A%20%20%20%20orders%2C%0A%20%20%20%20lineitem%2C%0A%20%20%20%20nation%0AWHERE%0A%20%20%20%20c_custkey%20%3D%20o_custkey%0A%20%20%20%20AND%20l_orderkey%20%3D%20o_orderkey%0A%20%20%20%20AND%20o_orderdate%20%26gt%3B%3D%20'1993-10-01'%0A%20%20%20%20AND%20o_orderdate%20%26lt%3B%20'2013-10-01'%20%0A%20%20%20%20AND%20l_returnflag%20%3D%20'R'%0A%20%20%20%20AND%20c_nationkey%20%3D%20n_nationkey%0AGROUP%20BY%0A%20%20%20%20c_custkey%2C%0A%20%20%20%20c_name%2C%0A%20%20%20%20c_acctbal%2C%0A%20%20%20%20c_phone%2C%0A%20%20%20%20n_name%2C%0A%20%20%20%20c_address%2C%0A%20%20%20%20c_comment%0AORDER%20BY%0A%20%20%20%20revenue%20desc%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERunning%20this%20query%20on%20the%20%3CSTRONG%3ESQL%20MI%20BC%20Standard-series%3C%2FSTRONG%3E%20takes%20around%20%3CSTRONG%3E49%20seconds%3C%2FSTRONG%3E%26nbsp%3Bafter%20warm-up%20and%20produces%20the%20following%20execution%20plan%20that%20contains%201%20spill%20operation%20for%20the%20Hash%20Match%20inner%20join%20operation.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20image-alt%3D%22NikoNeugebauer_0-1635805408926.png%22%20style%3D%22width%3A%20957px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F322572i3D123F2A6B2ED714%2Fimage-dimensions%2F957x242%3Fv%3Dv2%22%20width%3D%22957%22%20height%3D%22242%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_0-1635805408926.png%22%20alt%3D%22NikoNeugebauer_0-1635805408926.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThe%20problem%20is%20caused%20by%20the%20lack%20of%20the%20available%20memory.%20The%20memory%20grant%20that%20was%20given%20for%20processing%20the%20data%20is%20%3CSTRONG%3E6216%20MB%3C%2FSTRONG%3E%2C%20that%20is%20by%20far%20not%20enough%20for%20this%20query.%20It%20resulted%20in%20almost%20%3CSTRONG%3E680.000%20pages%20spill%20into%20TempDB%3C%2FSTRONG%3E%2C%20hindering%20the%20performance%20greatly.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOn%20the%20%3CSTRONG%3ESQL%20MI%20BC%20Premium%20series%3C%2FSTRONG%3E%20hadware%20oferring%20the%20situation%20changes%20and%20on%20the%20first%20sight%20it%20gets%20worse%2C%20since%20not%20just%201%20but%202%20Hash%20Match%20operations%20are%20not%20getting%20enough%20memory%20to%20execute%20their%20operations%20(Inner%20Joins%20%26amp%3B%20Aggregate)%2C%20when%20in%20reality%20the%20execution%20time%20lowers%20to%20%3CSTRONG%3E43%20seconds%3C%2FSTRONG%3E%20on%20average.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20image-alt%3D%22NikoNeugebauer_2-1635805712773.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F322576i7395310C6270CAD0%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_2-1635805712773.png%22%20alt%3D%22NikoNeugebauer_2-1635805712773.png%22%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3EGoing%20a%20step%20deeper%20uncovers%20that%20we%20have%20received%20a%20%3C%2FSPAN%3E%3CSTRONG%20style%3D%22font-family%3A%20inherit%3B%22%3E8777%20MB%20%3C%2FSTRONG%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3Ememory%20grant%20versus%20the%20original%20one%20%3C%2FSPAN%3E%3CSTRONG%20style%3D%22font-family%3A%20inherit%3B%22%3E6216%20MB%3C%2FSTRONG%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E%20fore%20the%20Standard%20series%20(34%25%20improvement)%2C%26nbsp%3Band%20that%20increase%20resulted%20in%20around%20%3C%2FSPAN%3E%3CSTRONG%20style%3D%22font-family%3A%20inherit%3B%22%3E475.000%3C%2FSTRONG%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E%20pages%20spill%20in%20TempDB%20versus%20the%20%3C%2FSPAN%3E%3CSTRONG%20style%3D%22font-family%3A%20inherit%3B%22%3E680.000%3C%2FSTRONG%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E%20pages%20spill%20for%20the%20Standard%20series%20(a%2029%25%20improvement)%20and%20hence%20justification%20for%20the%20difference%20in%20execution%20time%20which%20itself%20reflects%20as%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%20style%3D%22font-family%3A%20inherit%3B%22%3E43%20seconds%20vs%2049%20seconds%3C%2FSTRONG%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E%20%E2%80%93%20meaning%20a%20practical%20%3C%2FSPAN%3E%3CSTRONG%20style%3D%22font-family%3A%20inherit%3B%22%3E12%25%20improvements%3C%2FSTRONG%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E%20in%20the%20execution%20time.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBy%20running%20this%20query%20on%20the%20%3CSTRONG%3ESQL%20MI%20BC%20Premium-series%20Memory-Optimized%3C%2FSTRONG%3E%20hardware%20offering%2C%20the%20first%20thing%20you%20will%20notice%20is%20that%20it%20takes%20just%20%3CSTRONG%3E22%20seconds%3C%2FSTRONG%3E%20with%20the%20following%20execution%20plan%20that%20suffers%20no%20TempDB%20spilling%20problems%20as%20you%20can%20see%20on%20the%20execution%20plan%20below%3A%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NikoNeugebauer_2-1635806339638.png%22%20style%3D%22width%3A%20944px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F322599iDC3AF59D8BDB3DE2%2Fimage-dimensions%2F944x242%3Fv%3Dv2%22%20width%3D%22944%22%20height%3D%22242%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_2-1635806339638.png%22%20alt%3D%22NikoNeugebauer_2-1635806339638.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThe%20memory%20grant%20has%20been%20scaled%20to%20the%20whooping%20%3CSTRONG%3E18%20GB%3C%2FSTRONG%3E%20instead%20of%20under%20%3CSTRONG%3E9%20GB%3C%2FSTRONG%3E%20that%20was%20given%20for%20the%20Premium%20Series%2C%20and%20that%20amount%20was%20enough%20to%20process%20the%20data%20without%20interaction%20with%20TempDB%20%E2%80%93%20and%20thus%20improving%20the%20overall%20performance%20almost%20%3CSTRONG%3E2%20times%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnd%20on%20the%20picture%20below%20you%20can%20see%20the%20overview%20between%20the%20execution%20differences%20for%20each%20of%20the%20selected%20offerings%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22NikoNeugebauer_5-1635806474416.png%22%20style%3D%22width%3A%20914px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F322606iB660150840CE1963%2Fimage-dimensions%2F914x457%3Fv%3Dv2%22%20width%3D%22914%22%20height%3D%22457%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_5-1635806474416.png%22%20alt%3D%22NikoNeugebauer_5-1635806474416.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-381083216%22%20id%3D%22toc-hId-381176498%22%3ERunning%20many%20parallel%20queries%3C%2FH2%3E%0A%3CP%3EFor%20the%20second%20scenario%20we%20have%20opted%20to%20run%20many%20parallel%20queries%20to%20see%20how%20the%20SQL%20MI%20will%20behave%20and%20process%20them.%20To%20make%20it%20simpler%2C%20we%20have%20chosen%20another%20TPC-H%20based%20query%20that%20we%20have%20put%20inside%20a%20Stored%20Procedure%20as%20indicated%20on%20the%20code%20below%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3ECREATE%20OR%20ALTER%20PROC%20dbo.GetAnalyticsDemo%20AS%0ABEGIN%0A%20SET%20NOCOUNT%20ON%3B%0A%0A%20SELECT%20100.00%20*%20sum(case%0A%20%20%20%20when%20p_type%20like%20'PROMO%25'%0A%20%20%20%20%20then%20l_extendedprice%20*%20(1%20-%20l_discount)%0A%20%20%20%20else%200%0A%20%20%20end)%20%2F%20sum(l_extendedprice%20*%20(1%20-%20l_discount))%20as%20promo_revenue%0A%20%20FROM%0A%20%20%20lineitem%2C%0A%20%20%20part%0A%20%20WHERE%0A%20%20%20l_partkey%20%3D%20p_partkey%0A%20%20%20AND%20l_shipdate%20%26gt%3B%3D%20%20'1995-09-01'%0A%20%20%20AND%20l_shipdate%20%26lt%3B%20'1995-10-01'%3B%0AEND%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThat%20was%20done%20to%20simplify%20the%20example%2C%20given%20that%20each%20of%20this%20queries%2Fstored%20procedures%20will%20ask%20for%20a%20Memory%20Grant%20of%20around%20%3CSTRONG%3E3.5%20GB%20of%20RAM%3C%2FSTRONG%3E.%20This%20allow%20us%20to%20exhaust%20very%20fast%20the%20available%20amounts%20of%20RAM%20and%20respective%20memory%20grants%20for%20each%20of%20the%20SQL%20MI%20instance%20hardware%20offerings%20without%20going%20into%20hundreds%20of%20parallel%20queries.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20execute%20the%20queries%20in%20parallel%2C%20we%20have%20used%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D103126%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3ERML%20Utilities%20for%20SQL%20Server%20-%20Update%202021%3C%2FA%3E%26nbsp%3Bwith%20a%20traditional%20tool%20for%20the%20parallel%20workload%20testing%20-%20the%26nbsp%3B%3CSTRONG%3Eostress%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3EBelow%20is%20the%20invocation%20code%20that%20I%20have%20used%20to%20execute%20the%20workload%20and%20if%20you%20are%20trying%20this%20scenario%2C%20please%20do%20not%20forget%20to%20substitute%20the%20name%20of%20the%20instance%2C%20the%20username%20and%20the%20password%20to%20the%20real%20ones.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Eostress%20-S%22MYSUPERMIINSTANCEDEMO.public.123456notvisible.database.windows.net%2C3342%22%20-Q%22EXECUTE%20TPCH300.dbo.GetAnalyticsDemo%3B%22%20-n15%20-r3%20-UsecretUser%20-PMj3243NGFik234%3F%3F!%40M%23%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20this%20test%20we%20decided%20to%20run%2015%20users%20in%20a%20loop%20with%203%20repetitions%2C%20making%20sure%20that%20the%20queries%20won't%20finish%20right%20away%20until%20I%20would%20test%20them%20through.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EFor%20observing%20which%20queries%20get%20a%20memory%20grant%20and%20which%20one%20are%20stuck%2C%20I%20have%20used%20the%20following%20query%2C%20extracting%20the%20information%20from%20the%20%3CSTRONG%3Esys.dm_exec_memory_grants%3C%2FSTRONG%3E%20DMV%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3ESELECT%20sqlt.%5Btext%5D%20as%20QueryText%0A%20%20%20%2C%20CAST(((t1.requested_memory_kb)%2F1024.00)%20AS%20DECIMAL(9%2C2))%20RequestedMemoryMB%0A%20%20%20%2C%20CAST(((t1.granted_memory_kb)%2F1024.00)%20AS%20DECIMAL(9%2C2))%20GrantedMemoryMB%0A%20%20%20%2C%20CAST(((t1.used_memory_kb)%2F1024.00)%20AS%20DECIMAL(9%2C2))%20UsedMemoryMB%0A%20%20%20%2C%20CASE%20WHEN%20t1.grant_time%20IS%20NULL%20THEN%20'Waiting'%20ELSE%20'Granted'%20END%20AS%20RequestStatus%0A%20FROM%20sys.dm_exec_query_memory_grants%20t1%0A%20%20CROSS%20APPLY%20sys.dm_exec_sql_text(t1.sql_handle)%20sqlt%0A%20ORDER%20BY%20RequestStatus%20DESC%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOn%20the%20%3CSTRONG%3EStandard%20series%3C%2FSTRONG%3E%20hardware%20offering%20the%20picture%20is%20quite%20clear%20-%20just%206%20out%20of%20the%2015%20queries%20are%20getting%20their%20memory%20grants%20in%20parallel%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NikoNeugebauer_4-1635808740487.png%22%20style%3D%22width%3A%20661px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F322657i216E1086F662407F%2Fimage-dimensions%2F661x275%3Fv%3Dv2%22%20width%3D%22661%22%20height%3D%22275%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_4-1635808740487.png%22%20alt%3D%22NikoNeugebauer_4-1635808740487.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOn%20the%20%3CSTRONG%3EPremium%20series%3C%2FSTRONG%3E%20hardware%20offering%2C%20we%20observe%20that%20the%20number%20grows%20up%20to%20%3CSTRONG%3E9%20queries%3C%2FSTRONG%3E%2C%20meaning%20we%20have%20a%20potential%26nbsp%3B%3CSTRONG%3E50%25%20capacity%20increase%3C%2FSTRONG%3E%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NikoNeugebauer_5-1635808961192.png%22%20style%3D%22width%3A%20662px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F322665iC03DC27747FA0DBB%2Fimage-dimensions%2F662x303%3Fv%3Dv2%22%20width%3D%22662%22%20height%3D%22303%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_5-1635808961192.png%22%20alt%3D%22NikoNeugebauer_5-1635808961192.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOn%20the%20%3CSTRONG%3EPremium%20series%3C%2FSTRONG%3E%26nbsp%3B%3CSTRONG%3EMemory%20Optimized%3C%2FSTRONG%3E%20hardware%20offering%2C%20all%20queries%20get%20the%20requested%20memory%20grants%20and%20every%20process%20will%20be%20able%20to%20advance%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NikoNeugebauer_2-1635808363220.png%22%20style%3D%22width%3A%20660px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F322645iD35C5490B74BE470%2Fimage-dimensions%2F660x281%3Fv%3Dv2%22%20width%3D%22660%22%20height%3D%22281%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_2-1635808363220.png%22%20alt%3D%22NikoNeugebauer_2-1635808363220.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThe%20key%20role%20of%20operational%20memory%20in%20databases%20has%20been%20always%20a%20factor%20of%20achieving%20the%20highest%20performance%20for%20the%20memory%20intensive%20workloads%20and%20the%20new%20Hardware%20offerings%20for%20Azure%20SQL%20Managed%20Instance%20can%20certainly%20allow%20your%20memory%20hungry%20workloads%20to%20achieve%20new%20heights%20without%20scaling%20up%20the%20number%20of%20CPU%20vCores%2C%20which%20is%20certainly%20the%20best%20solution%20for%20the%20customer.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2911126%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20image-alt%3D%22NikoNeugebauer_5-1635806474416.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F322606iB660150840CE1963%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_5-1635806474416.png%22%20alt%3D%22NikoNeugebauer_5-1635806474416.png%22%20%2F%3E%3C%2FSPAN%3EWe%20want%20to%20share%20with%20you%20a%20couple%20of%20scenarios%20where%20the%20workloads%20benefit%20from%20the%20new%20hardware%20offering%20on%20Azure%20SQL%20Managed%20Instance.%20Make%20sure%20that%20when%20considering%20an%20upgrade%20to%20the%20newest%20hardware%20offering%20to%20check%20and%20verify%20whether%20your%20workload%20will%20benefit%20from%20the%20larger%20memory%20per%20CPU%20vCore%20ratio%20or%20the%20individual%20speed%20optimizations%20of%20the%20new%20hardware%20offerings%20on%20SQL%20MI.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2911126%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20SQL%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20SQL%20Managed%20Instance%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Co-Authors
Version history
Last update:
‎Nov 02 2021 04:42 AM
Updated by: