Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulten-zz authored Nov 13, 2020
1 parent d566ad8 commit 44fd161
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions ASJobGraphEvents/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Job Graph Events in Power BI / Azure Analysis Services

Job Graph events can be used to identify bottlenecks in data refreshes by highlighting the critical path. For instances of Analysis Services not running on-premise, the graph is broken into 16 Kb chunks, each in their own event. The events can be reassembled with this script.

# Summary

The Job Graph event is emitted by AS Engine before and after processing. Both graphs show the order that jobs execute within the sequence point algorithm. The final (annotated) graph shows execution times for each job. In addition, the annotated graph shows the critical path.
The Job Graph events are emitted by AS Engine before and after any processing (aka refresh) commands. Both job graphs show the order in which processing jobs execute within the sequence point algorithm, in the Analysis Services engine. The graph associated with the GraphEnd (2) Subclass is annotated, in that it contains the "Blocked duration", "Waiting duration", "Running duration" etc for each job. In addition, the annotated graph shows the critical path. Job Graph events can be used to identify bottlenecks in processing jobs, by highlighting the critical path.

In the cloud instances of Analysis Services, such as Azure Analysis Services or Power BI, the job graph is broken down into smaller chunks, each in their own event. The events can be reassembled with this script.

## Critical Path

Expand All @@ -22,33 +20,38 @@ The critical path is shown via dark backgrounds and white text in the job graph
## Usage

1. Start a trace in SQL Server Profiler and select "Job Graph Events".
2. Start a data refresh ("Process Full" in SQL Server Management Studio).
3. Wait for all trace events to arrive in Profiler.
4. `File > Save As > Trace XML File`
5. Aim `rebuild.py` at this file like so:
2. Initate processing (eg. "Process Full" in SQL Server Management Studio).
3. Wait for the processing to finish
4. Once the processing is finished, wait for all job graph events to show up in SQL Profiler. NOTE : The first event in a subclass is always the metadata, which contains, among other things, the number of additional events that'll follow.
5. Save all the events in a trace file, `File > Save As > Trace XML File`
6. Rebuild the annotated job graph by aiming the script `rebuild.py` at this file like so:

```bash
python rebuild.py path\to\trace.xml output_folder
```

6. Inside `output_folder` there will be two .DGML files, which can be opened in Visual Studio.
7. Inside `output_folder` there will be two .DGML files, which can be opened in Visual Studio.

# Diagnosing from DGML

Now that the graph is open, look for the critical path (darker nodes) or for failed jobs (white with a dashed border). Failed jobs include an "Error Code" that specifies why the job failed.
Once the Job Graph is rendered, look for the critical path (darker nodes) or for failed jobs (white with a dashed border). Failed jobs include an "Error Code" that specifies why the job failed.

To diagnose slow refresh times, look for the critical path and start at the top. Look at "Blocked duration", "Waiting duration", and "Running duration". If a job has a long blocked duration, it spent a long time waiting on other jobs. If a job has a long waiting duration, it was waiting for an available thread, so increasing maxParallelism could help. If a job has a long running duration, then the model might have to be changed to speed up the job.

# Creating a Gantt Chart

The Gantt Chart can also come in handy when diagnosing processing issues. Power BI Desktop provides first party and 3rd party Gantt Chart visuals, that can be used to visualize the job graph.

We have also provided a script to generate a Gantt Chart as a simple HTML file. Please follow the below instructions to generate the HTML

## Requirements

* Python 3.8 or later
* A valid job graph DGML file (from above)

## Usage

1. Get a .DGML file with all the anntoations (running duration, waiting duration, etc.)
1. Get the reconstructed DGML file corresponding to the annotated graph, i.e the GraphEnd (2) Subclass
2. Run `gantt\script.py` like so:

```bash
Expand Down

0 comments on commit 44fd161

Please sign in to comment.