Power BI Premium Max Parallelism through Phil's Report
https://dax.tips/2021/02/15/visualise-your-power-bi-refresh/

Power BI Premium Max Parallelism through Phil's Report

Power BI Refresh optimization can be tricky to visualize, unless we have access to Phil Seamark's "Visualize your power bi refresh" report.

I was investigating overload of a P3 capacity, after narrowing down to one dataset, we captured a trace as mentioned in Phil's blog. I added some additional events such as "Command Begin" and "Command End" along with Notification Events and others.

Phil's blog shows how to save trace as XML file, i traditionally use SQL Server so i used "Save As" --> "Trace Table".

No alt text provided for this image

My first challenge was i forgot to capture "Job Graph Events" and realized that i could still use Object Name by Event Subclass chart which shows Execute SQL vs Process timeline. I modified the "Progress Report End" Power Query as follows.

let
? ? Source = Sql.Database("winx", "TestDB", [Query="select ActivityID,EventSubclass,Duration,RequestID,StartTime,TextData,UserObjectID,SessionID,ObjectName,CPUTime,IntegerData,EndTime
from dbo.BaseLine
where EventClass=6 and EventSubclass in (1,17,25,59)"]),
? ? #"Changed Type1" = Table.TransformColumnTypes(Source,{{"StartTime", type datetimezone}, {"EndTime", type datetimezone}, {"Duration", Int64.Type}, {"CPUTime", Int64.Type}}),
? ? #"Renamed Columns" = Table.RenameColumns(#"Changed Type1",{{"Duration", "Duration (ms)"}})
in
? ? #"Renamed Columns"        

Since, i didn't had Job Graph Events i removed that part of the logic. Then, we need a custom visual("as timeline", a visual by pragmaticworks) . After making some tweaks, i got the report working, i added some filters to remove object where the durations were less than a second.

No alt text provided for this image
Object Name with Event Sub Class (Execute SQL and Process) with timeline.

How do we interpret the visual highlighted, notice that there are 5 blocks of process grouped at the very top, followed by a stepped layout which shows another blocks starting. If we correlate this event with "Command Begin" shown below, notice the Max Parallelism clause. A maximum of 6 object would be processing parallelly, in above chart we can 5 (one is removed as the duration is less than a second, but i think you got it)

No alt text provided for this image
Default Max Parallelism

Chris Webb blogged about "Max Parallelism" and have explained in depth.

On a P3 this number can be up to 40 as per the following article, or at least that is how i interpret it. Look at "Model refresh parallelism" in the table with different capacity SKUs.

So, we performed another test using Max Parallelism of 30, here is how the "Command Begin" Event looks like.

No alt text provided for this image
Max Parallelism of 30

Luckily, this time we capture "Job Graph Event", but when i try to save the events as "Trace XML File", and then use that in the report i get following error.

No alt text provided for this image
XML Table error

As part of the transformation logic there is a parsed XML step which is failing with error "There are multiple root elements". When looking at the XML output the error kind of make sense, there are two root elements with DirectedGraph. I dumped the data into SQL and used the following query to investigate.

select? RequestID,SessionID, convert(xml,STRING_AGG(cast(TextData as nvarchar(MAX)),''))
from dbo.KLAIncremental?
where EventClass=134 and EventSubclass=2
group by RequestID,SessionID        
No alt text provided for this image
DirectedGraph

Since the dataset in question had incremental refresh enabled, an additional command begin event were generated to Analyze Refresh Policy Impact, which includes a Job Graph. I then had to rewrite my SQL as follows to get only the last DirectedGraph. (My T-SQL may not be optimal and in-efficient, this is with my ancient T-SQL knowledge).

select RequestID,SessionID, STRING_AGG(cast(TextData as nvarchar(MAX)),'') TextData
from (
select RequestID,SessionID,?
TextData?
from dbo.Incremental?
where EventClass=134 and EventSubclass=2 and RowNumber >=?
(select max(RowNumber) MaxRowNumber
from ( select RequestID,SessionID,?
		TextData, CHARINDEX('<DirectedGraph',TextData) DirectGraph,RowNumber
		from dbo.Incremental?
		where EventClass=134 and EventSubclass=2
		order by RowNumber?
		offset 1 row
	) T
where DirectGraph=1)
order by RowNumber
offset 0 row
)q?
group by RequestID,SessionID        

I then modified my jobgraph power query as follows.

let
? ? Source = Sql.Database("winx", "TestDB", [Query="select RequestID,SessionID, STRING_AGG(cast(TextData as nvarchar(MAX)),'') TextData#(lf)from (#(lf)select RequestID,SessionID, #(lf)TextData #(lf)from dbo.Incremental #(lf)where EventClass=134 and EventSubclass=2 and RowNumber >= #(lf)(select max(RowNumber) MaxRowNumber#(lf)from ( select RequestID,SessionID, #(lf)#(tab)#(tab)TextData, CHARINDEX('<DirectedGraph',TextData) DirectGraph,RowNumber#(lf)#(tab)#(tab)from dbo.Incremental #(lf)#(tab)#(tab)where EventClass=134 and EventSubclass=2#(lf)#(tab)#(tab)order by RowNumber #(lf)#(tab)#(tab)offset 1 row#(lf)#(tab)) T#(lf)where DirectGraph=1)#(lf)order by RowNumber#(lf)offset 0 row#(lf))q #(lf)group by RequestID,SessionID"]),
? ? #"Parsed XML" = Table.TransformColumns(Source,{{"TextData", Xml.Tables}}),
? ? #"Expanded TextData" = Table.ExpandTableColumn(#"Parsed XML", "TextData", {"Nodes"}, {"Nodes"}),
? ? #"Expanded Nodes" = Table.ExpandTableColumn(#"Expanded TextData", "Nodes", {"Node"}, {"Node"}),
? ? #"Expanded Node" = Table.ExpandTableColumn(#"Expanded Nodes", "Node", {"Attribute:Label", "Attribute:Slot"}, {"Attribute:Label", "Attribute:Slot"}),
? ? #"Filtered Rows" = Table.SelectRows(#"Expanded Node", each Text.Contains([#"Attribute:Label"], "Process Partition")),
? ? #"Split Column by Delimiter" = Table.SplitColumn(#"Filtered Rows", "Attribute:Label", Splitter.SplitTextByEachDelimiter({"["}, QuoteStyle.Csv, true), {"Attribute:Label.1", "Attribute:Label.2"}),
? ? #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Attribute:Label.1", type text}, {"Attribute:Label.2", type text}}),
? ? #"Split Column by Delimiter1" = Table.SplitColumn(#"Changed Type", "Attribute:Label.2", Splitter.SplitTextByEachDelimiter({"]"}, QuoteStyle.Csv, true), {"Attribute:Label.2.1", "Attribute:Label.2.2"}),
? ? #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"Attribute:Label.2.1", type text}, {"Attribute:Label.2.2", type text}}),
? ? #"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"Attribute:Label.1", "Attribute:Label.2.2"}),
? ? #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Attribute:Label.2.1", "ObjectName"}}),
? ? #"Added Prefix" = Table.TransformColumns(#"Renamed Columns", {{"Attribute:Slot", each "00" & _, type text}}),
? ? #"Cleaned Text" = Table.TransformColumns(#"Added Prefix",{{"Attribute:Slot", Text.Clean, type text}}),
? ? #"Extracted Last Characters" = Table.TransformColumns(#"Cleaned Text", {{"Attribute:Slot", each Text.End(_, 2), type text}})
in
? ? #"Extracted Last Characters"        

Then i modified "Progress report End" power query as follows.

let
? ? Source = Sql.Database("winx", "TestDB", [Query="select ActivityID,EventSubClass,Duration,RequestID,StartTime,TextData,UserObjectID,SessionID,ObjectName,CPUTime,IntegerData,EndTime#(lf)from dbo.Incremental#(lf)where EventClass=6 and EventSubclass in (1,17,25,59)#(lf)"]),
? ? #"Changed Type1" = Table.TransformColumnTypes(Source,{{"StartTime", type datetimezone}, {"EndTime", type datetimezone}, {"Duration", Int64.Type}, {"CPUTime", Int64.Type}}),
? ? #"Renamed Columns" = Table.RenameColumns(#"Changed Type1",{{"Duration", "Duration (ms)"}}),
? ? #"Merged Queries" = Table.NestedJoin(#"Renamed Columns", {"SessionID", "ObjectName","RequestID"}, JobGraph, {"SessionID", "ObjectName","RequestID"}, "JobGraph", JoinKind.LeftOuter),
? ? #"Expanded JobGraph" = Table.ExpandTableColumn(#"Merged Queries", "JobGraph", {"Attribute:Slot"}, {"Attribute:Slot"})
in
? ? #"Expanded JobGraph"        

Now, i get report where i can see slots and Event Sub class (Execute SQL and Process) timeline view.

No alt text provided for this image
30 slot view.

Bottom line is you could use Phil's report to visualize max parallelism and take advantage of premium capacity to increase it. Phil even summarizes what we can do in case we see SQL or Process taking time, ensure to read both the references they are gold.

Hariom Jindal ??

Founder | IT Solutions | Microsoft & Cloud Expert | 20+ Years of Driving Business Transformation | Helping Businesses Work Smarter with Technology

1 年

that is really good one ?? Raju Kumar

要查看或添加评论,请登录

Raju Kumar的更多文章

  • Moving Semantic Model and reports connected to a lakehouse

    Moving Semantic Model and reports connected to a lakehouse

    As my team continue to support Migration from P to F SKU, we get different questions and scenarios which we haven't…

    2 条评论
  • Post Import In Group and Dataflow

    Post Import In Group and Dataflow

    As my team is focused on migration to Microsoft Power BI or Microsoft Fabric, last week I had the opportunity to work…

    1 条评论
  • Data Mesh & Premium Capacity Migration

    Data Mesh & Premium Capacity Migration

    With the recent announcement of retiring PBI premium capacity and migrating to new Fabric capacity, there is an…

  • Fabric Notebook and Private Endpoint

    Fabric Notebook and Private Endpoint

    While connecting to an Azure SQL database recently using Microsoft Fabric Notebook i got this error. Error connecting…

  • PowerBIEntityNotFound Fabric Private Links and XMLA endpoint

    PowerBIEntityNotFound Fabric Private Links and XMLA endpoint

    Microsoft Fabric allows us to create private endpoints for Fabric, private link are used to send data traffic privately…

  • Azure-SSIS Runtime

    Azure-SSIS Runtime

    Recently I got to work with a government customer where they need to migrate their existing SSIS packages to Azure Data…

  • Composite Model , Aggregation, Azure Databricks

    Composite Model , Aggregation, Azure Databricks

    Power BI Premium's composite model can be a very attractive solution while migrating from a large AAS Model. This time…

    1 条评论
  • PBIP & TMSL getting project file from AAS model

    PBIP & TMSL getting project file from AAS model

    Recently i have been assisting customers migrate their AAS databases to Power BI. There are multiple ways of doing the…

    1 条评论
  • RDL Migration to Power BI Premium

    RDL Migration to Power BI Premium

    Recently, our Customer Success Unit (CSU) team within Microsoft has started migrating On-Premises SSRS (rdl) /…

  • Export Power BI Report, RLS, UserPrincipalName, and CustomData

    Export Power BI Report, RLS, UserPrincipalName, and CustomData

    This blog is my personal and doesn't represent views of Power BI Product team or Microsoft. This time my customer ran…

社区洞察

其他会员也浏览了