Monitoring and Tuning Analysis Services with SQL Profiler, Part 1
- SQL Profiler Events for Analysis Services
- SQL Profiler Columns for Analysis Services
SQL Server Analysis Services (SSAS) is an enterprise-class data analytics and aggregation engine that offers much flexibility and ease for developing business intelligence applications. Building a small, trivial cube isn't complicated, but when SSAS cubes grow to a reasonable size and complexity, querying and processing performances often don't live up to customers' expectations. Fortunately, Microsoft offers a few tools for looking under the hood and detecting the root cause of issues. SQL Profiler is arguably the most informative tool for monitoring and troubleshooting Analysis Services (the tool works with Analysis Services 2005 and later versions).
In this article, I discuss the SQL Profiler framework for identifying most commonly encountered problems. After you're familiar with Profiler events and columns, part 2 of this series examines how to use Profiler events to detect and resolve querying, processing, and synchronization performance issues. I'll also discuss using Profiler for load testing to ensure that your application is ready for production use.
SQL Profiler Events for Analysis Services
SQL Profiler supports a multitude of Analysis Services events, and you can collect a number of columns for each event. Collecting every event and every column on a busy server is impractical because the resulting trace would grow rapidly to unmanageable size and be difficult to decipher. For occasional troubleshooting, we need to focus on a few events that are relevant for the task at hand. For ongoing monitoring, it's useful to collect a larger set of events and columns for historical analysis, which I'll discuss in part 2 of this series.
Table 1 quickly summarizes the Profiler events we can capture. Study this table to come up with a list of events that would be helpful for your monitoring and tuning effort. Please note that Microsoft tends to add Profiler events with each version, so the list available in your environment might differ slightly from the one in Table 1, depending on the Analysis Services version you're using.
Table 1
Analysis Services Profiler Events
Event Category |
Event |
Description/Example |
Command Events |
Command Begin Command End |
Captures the following commands:
|
Discover Events |
Discover Begin Discover End |
Captures retrieval of metadata. For example, a discover command is executed when a user connects to SSAS by using SQL Server Management Studio and expands folders of databases, cubes, and measure groups; checks partition properties. |
Discover Server State Events |
Server State Discover Begin Server State Discover Data Server State Discover End |
SSAS occasionally checks its own health through these events by taking a snapshot of server state. This is done by submitting discover connections, discover sessions, discover jobs, and other commands. Frequency of execution of these commands is controlled by the <FlightRecorder><SnapshotFrequencySec> setting in the msmdsrv.ini configuration file. The commands to be executed are included in the FlightRecorderSnapshotDef.xml file found in the bin folder of the SSAS installation directory. |
Errors and Warnings |
Error |
The error number reported by this event can be helpful when troubleshooting an issue with assistance from Microsoft support. |
Locks |
Deadlock Lock Timeout |
SSAS is predominantly a read-only system, but we write data when creating files through processing, synchronization, and other means. A deadlock normally occurs when two commands are attempting to modify the same object. Lock timeout can be encountered if a long-running query blocks a processing or synchronization command, or vice versa. |
Notification Events |
Notification |
Records creation, modification, or deletion of an object. For example, as soon as you start a Profiler trace, it will capture a notification event recording its own creation. |
Progress Reports |
Progress Report Begin Progress Report Current Progress Report End Progress Report Error |
Records the current step of processing or querying a job's execution. For example, Progress Report Begin/End events are raised when we read a specific partition. Progress Report Error is raised when a user cancels a long-running query, or processing fails due to missing-key errors. |
Queries Events |
Query Begin Query End |
These events are useful for checking MDX or DMX query start time and total duration. |
Query Processing |
Calculate Non-Empty Begin Calculate Non-Empty Current Calculate Non-Empty End Execute MDX Script Begin Execute MDX Script Current Execute MDX Script End Get Data from Aggregation Get Data from Cache Query Cube Begin Query Cube End Query Dimension Query Subcube Query Subcube Verbose Serialize Results Begin Serialize Results Current Serialize Results End |
The most informative category for comprehending how the query is resolved. Query Subcube event shows a vector of dimension attributes that SSAS reads to resolve the query. This is the same series of ones and zeros that you find in the query log. Each query could read multiple subcubes to derive the requested result. Query Subcube Verbose event returns detailed information about the attribute values being retrieved. Serialize Results * events indicate that the requested cell-set is being displayed to the user who submitted the query. |
Security Audit |
Audit Backup/Restore Event Audit Login Audit Logout Audit Object Permission Event Audit Server Starts and Stops |
Auditing various types of activity on the server. Primarily useful for long-term monitoring. |
Session Events |
Existing Connection Existing Session Session Initialize |
Displays existing connections and sessions, as well as requests for new sessions. This category is useful when you first start a trace with the Profiler user interface, to gauge how busy your server is. |
From Table 1, we can surmise that progress reports, command events, query events, and query processing are the most useful categories for detecting query and processing performance issues. Other categories come in handy for troubleshooting, though, so don't discount them yet!