300 likes | 501 Views
Adam Jorgensen Pragmatic 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. Client Application MDX Query.
E N D
Adam Jorgensen Pragmatic 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 Client Application MDX Query Session Management XML/A Listener Session Manager Security Manager Query Processing Query Processor Cache Query Processor Data Retrieval Storage Engine Cache Storage Engine Dimension Data Measure Group Data Attribute Store Fact Data Hierarchy Store Aggregations Session Management Query Processing Data Retrieval
Job Architecture Request Coordinator Job • CoordinatorExecutionMode • Negative means max number of jobs per core • Zero means no limit • Positivemeans number of jobs per server • Default is -4 • Works in tandem with • MAXTHREADS and • MAXPARALLEL Job 1 Job 2 … Job N Thread Thread Thread Thread
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 Query Context Session Context Global Context • 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
Data Retrieval Coordinator Job First Segment Job Second Segment Job … Last Segment Job Thread Thread Thread
Agenda SSAS Query Processing Architecture Enhancing Query Performance Improving Processing Performance Tuning Server Resources
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
Diagnosing the Problem • Query Processor • See delay in other steps (query processing) • Optimize MDX • Look for redundant queries Vs. • Storage Engine • Long running sub-cube events • Optimize dimension design • Design aggregations • Use partitions
Demo Using SSAS and Profiler Get the query Excel is running
Identify Attribute Relationships Optimized Original • 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 • Sizing • Increasing processing speed and flexibility • Increase manageability of bringing in new data • Support multiple aggregation designs • 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)
Demo Implementing Partitions
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
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
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
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