נועם

Embed Size (px)

Citation preview

  • 1. SQL ServerParallel Processingfor Pros

2. Agenda Parallel Processing Concepts Single Query Optimization Workload Optimization 3. Parallel ProcessingHow does it Work ? 4. Preemptive Scheduling Thread 1 CMD CMDCore Scheduler CMD Thread 2 CMD CMD CMD Thread 3 CMD CMDContext Switch CMD 5. How does it work in SQL Server Thread Pool(Workers)Tasks BatchCPU Core SELECT TaskRead .. Read ..Write UPDATE .Calculate .WritePending Tasks Scheduler Max Workers !! 6. CPU Scheduling Runnable QueueSuspended (Waiting) TasksCPU CoreIO_COMPLETIONRead LCK_M_XCalculateWrite Scheduler Running Task - Worker Pending TasksReadWrite 7. Now you own theParallelism Matrix ! 8. What about the1 Million Dollar Question ? 9. What degree of parallelism (DOP) is optimal ? 10. Parallel System Configuration MAXDOP Cost Threshold for Parallelism Max Workers 11. Parallel System Configuration MAXDOP Cost Threshold for Parallelism Max Workers 12. MaxDop Default Microsoft Recommendation Other Recommendations: Start with Cores / 3 - Cores / 2 and check CXPACKET 13. MaxDop What people do?http://www.sqlskills.com/BLOGS/PAUL/post/MAXDOP-configuration-survey-results.aspx 14. Waits What people have?http://www.sqlskills.com/BLOGS/PAUL/post/Wait-statistics-or-please-tell-me-where-it-hurts.aspx 15. MaxDop Its only a hint, SQL Server might still choosea serial plan Change of MAXDOP setting for theserver, will flush the plan cache. 16. Parallel System Configuration MAXDOP Cost Threshold for Parallelism Max Workers 17. Cost Threshold for Parallelism Default (5) Other Recommendations: 5 is too low, Get it higher to 50Jonathan Kehayias Recommendation 18. My RecommendationIt really depends on your workload, you needto first test:For OLTP have Higher Cost Threshold (50) Start with low MAXDOP (8-12)For OLAP have Higher Cost Threshold (50) Start with high MAXDOP (Cores / 2) 19. My RecommendationsRun Jonathan Kehayias Script to tune CostThreshold for Parallelism.Run a trace, change MAXDOP, rerun a traceon the same workload and run QureAnalyzer (Free !) until you find the perfectMAXDOP.Override MAXDOP if necessary (Use PlanGuides): In OLTP override with a higher MAXDOP. In OLAP override with a lower MAXDOP. 20. Become a true Pro !Join one of our courses: SQL Server 2012 Guy Glantser Storage for DBAs Tzahi Hakikat Advanced Programming in SQL Server Noam BrezisContact Us: www.madeira.co.il 21. Thank youTo: Guy Glantser (Madeira) Haim Fishner (Madeira) Adam Machanic R Meyyappan (http://www.sqlworkshops.com/)Contact Us: www.madeira.co.il 22. Thank You! Noam Brezis Email:[email protected]:www.madeira.co.il