Adam Jorgensen Pragmatic Works Performance Optimization in SQL Server Analysis Services 2008.

Post on 30-Mar-2015

214 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

Transcript

Adam JorgensenPragmatic Works

Performance Optimization in SQL Server Analysis Services 2008

Agenda

• SSAS Query Processing Architecture• Enhancing Query Performance• Improving Processing Performance• Tuning Server Resources

Query Processing Architecture

• Session Management

• Query Processing

• Data Retrieval

Session Management

XML/A Listener

Session Manager Security Manager

Query Processing

Query Processor Query Processor Cache

Data Retrieval

Storage Engine Storage Engine Cache

Dimension Data

Attribute Store

Hierarchy Store

Measure Group Data

Fact Data

Aggregations

Client Application MDX Query

Job Architecture

Coordinator Job

Job 1

Thread

Request

Job 2

Thread

Job N

Thread

Thread

• CoordinatorExecutionMode• Negative means max

number of jobs per core• Zero means no limit• Positive means number of

jobs per server• Default is -4• Works in tandem with

MAXTHREADS andMAXPARALLEL

Query Processor

• Executes MDX Queries and returns cell and row sets.

• Builds an execution Plan to translate request into one or more SubCube requests.

• Uses the Query Processor Cache to store the results for reusability

Query Processor Cache

• 3 Contexts• Cache Rules

– Calculations created at query time– Context is chose by scope– Try for maximum re-use in the

Global Cache• Partial Expressions are not

Cached Global Context

Session Context

Query Context

Data Retrieval

Coordinator Job

First Segment Job

Thread

Second Segment Job

Thread

Last Segment Job

Thread

Creates Sub-Cube Request

Storage Engine Cache (Y/N)

Aggregation (Y/N)

Fact Table/Partition

Agenda

• SSAS Query Processing Architecture• Enhancing Query Performance• Improving Processing Performance• Tuning Server Resources

Enhancing Query Performance

Base lining Query Speed

Diagnosing The Problem

Optimizing Dimensions

Maximizing Aggregations

Usage Based Optimization

Using Partitions

Optimizing MDX

Cache Warming

Base Lining Query Speed

• Trace Info– 0 – attribute is not included in query– * - ever member was requested– + - two or more members were requested– <integer value> - a single member of the

attribute was hit

Clear Cache

Trace Query

Warm Cache

Trace Again Compare

Diagnosing the Problem

• Storage Engine– Long running sub-

cube events• Optimize

dimension design• Design

aggregations• Use partitions

Vs.

• Query Processor• See delay in other

steps (query processing)• Optimize MDX• Look for

redundant queries

Demo

• Using SSAS and Profiler• Get the query Excel is running

Identify Attribute Relationships

Original

Optimized

• Default relations to Key• Base for Indexes

• Cross products don’t need to go through key

• Aggregations built on attributes can be used for related attributes

• Flexible vs. Rigid

Implementing Effective User Hierarchies

• Attribute vs. User Hierarchies– Aggregation Usage

Property• Natural vs. Unnatural

Hierarchies

Demo

• Attribute Relationships and Hierachies

Using Partitions

• Advantages– Partition Slicing– Aggregation Design

• Tips for Using Partitions– Slide Aggregations along

partition hierarchy• i.e. – Last 7 days, Last 30

Days, 90, 6 months, etc..

– Indexes or slices will not be defines for partitions with fewer rows (4096 default)

• Sizing

• Increasing processing speed and flexibility

• Increase manageability of bringing in new data

• Support multiple aggregation designs

Demo

• Implementing Partitions

Maximizing Aggregation Value

Detecting Aggregation Hits

Interpreting Aggregations

Building, Suggesting, Influencing

Aggregations

Demo

• Aggregations and Usage Based Optimization

Agenda

• SSAS Query Processing Architecture• Enhancing Query Performance• Improving Processing Performance• Tuning Server Resources

Processing Job Overview

• Parent – Child Jobs• Best Opportunity to Increase Performance and

Scale

Fact Table & Aggregations

Partition

Measure Group

Parent Processing Job

Parent Partition/ Child

Processing

Child Fact Data Child Aggregation

Parent Partition/ Child

Processing

Child Fact Data

Where Are You Spending Your Time?

• Partition or Dimension Processing ?• ProcessFull vs. ProcessData and ProcessIndex• During ProcessData

– MSOLAP:Processing – Rows read/Sec >0• During ProcessIndex

– MSOLAP:Proc Aggregations – Row created/Sec > 0

Dimension Processing Best Practices

• Use SQL Views to Implement Query Binding • Optimize Attribute Processing Across Multiple

Sources• Reduce Unnecessary Attributes• Adjust/Remove Bitmap Indexes• Tune Relational Processing Query

Partition Processing Architecture

• Processes Using Jobs• Three Concurrent Threads

– Send SQL to extract source data– LookUp Dimension Keys and

populate processing buffer– Write Buffer to disk when it fills

• Aggregations and Bitmap Indexes– May also overflow to disk –

created in memory during processing

Process Fact Data

Build Aggregations

Build Bitmap Indexes

Partition Processing Best Practices

• Inserts– ProcessFull vs. ProcessAdd– Rotating Partitions

• Updates– ProcessFull– Journaling to only implement Inserts

• (See Insert Techniques)

• Deletes– Partitioning– ProcessUpdate– Remove Data From Table and ProcessFull (longer)

• Pick Efficient Data Types

Tuning the Relational Query

• Minimal Joins in Source Queries• Partitioning Alignment

– Each SSAS partition should only hit 1 Relational Partition – More than 1 cube partition can hit 1 relational partition

• Clustered Indexes – Especially without 1:1 partition relationship

• Keep FillFactor VERY high • Data Compression – Reduce IO• Reduce Locking when possible

Tuning ProcessIndex Phase

• Avoid Spilling Data to Disk– MSOLAP:Proc

Aggregations\Temp file bytes written/sec

• MSOLAP:Proc Aggregations – Row created/sec– Increase means faster

aggregation processing• Eliminate IO bottleneck• Increase Partitions for

Parallelism

SegmentsSegments

Segments

PartitionProcess Job

Thre

ad 0

Thre

ad 1

Thre

ad n

n = CoordinatorBuilMaxThread

Agenda

• SSAS Query Processing Architecture• Enhancing Query Performance• Improving Processing Performance• Tuning Server Resources

Tuning Server Resources

• PreAllocate Physical Ram for SSAS– Hard reservation – otherwise memory will be

released when not under load• Using Large Pages

– Lock Pages in Memory– Cannot be swapped to page file

• Need to watch Carefully • Leave 20% for the OS

• Disable Flight Recorder

Questions and Where to Find Adam

top related