sqlserver performance tuning methodology and common tools

In the early articles, the DETECT methodology in performance tuning was mentioned, here is a brief review of the DETECT methodology.


Discover the problem: Discover the problem

Explore the conditions: Explore the reasons

Track down possible approaches: provide possible solutions

Execute the most likely approach: execute the best possible solution

Check of success: Confirm whether it is successful (if not, repeat the above steps)

Tie up loose ends: complete the remaining work


First look at Discover and find the problem

Has the whole problem been described succinctly?

Where is the user's current baseline?

What do users expect?

Not all problems can be solved


Look at Explore again to explore the reasons

Get evidence

  • SqlProfiler trace/Sql Trace
  • DMV and DMF
  • ShowPlan execution plan output
  • Performance counters for various systems
  • sqlserver-specific performance counters

Check the most obvious problem (don’t go deep into the problem)

 

Track down provides possible solutions

The first stage is to establish a plan to prove the hypothesis

The second stage is to establish a problem-solving plan


Execute the most likely solution

In the first stage, execute the test plan to prove your hypothesis

The second stage is to implement the solution to the problem


Check to confirm success

The first stage

Did your plan prove your hypothesis, or did it overthrow him?

second stage

  • Has your plan changed the phenomenon?
  • Has the bottleneck shifted?
  • Does the solution meet your original goals?

Remember: this process is usually executed recursively


Tie up complete the remaining work, the finishing touch

  • Will performance tuning have unpredictable marginal effects?
  • Did the modification really solve the problem? Will the same problem be encountered again in a short time?
  • What tracking work needs to be done?


The methodology mentioned above, although very boring, is still instructive. Here is some practical knowledge.


Bottleneck analysis

Definition of bottleneck

Bottleneck = rate at which demand is reached> actual processing volume

Process:

  • Decide at which point
  • Determine the status of waiting in the queue
  • Reduce input (the rate at which demand is reached) or increase simultaneous processing
  • Determine the benefits
  • Decision cost

Common bottleneck monitoring tasks

  • Monitor memory usage
  • Monitor thread and CPU usage
  • Monitor hard disk IO
  • Monitor low-performance queries
  • Monitor stored procedures, sql and user activities
  • Monitor current locks and user interaction

Establish a performance tuning plan

Performance tuning is an iterative process, repeated and repeated cycles, and approaching corrections time and time again. It is necessary to use written records to illustrate

  • Get the idea, highlight the problem and prove
  • System approach
  • Have a consensus and know where to talk about
  • Ability to summarize and compare
  • When there are multiple bottlenecks in the system, find the most critical and perform the tuning first with the lowest cost

When implementing a performance tuning plan, determine the impact on the online production environment


Methodology-zoom out




Common tasks in performance tuning


  • windows event viewer
  • windows system monitor
  • The current active window in SSMS
  • T-SQL tools
  • Sql Profiler
  • Query analyzer
  • Database Engine Optimization Consultant

Windows event viewer, mainly to view the following event log

  • windows application log
  • windows system log
  • windows security log

The windows system monitor can track:

  • sql server I/O
  • sql server memory
  • sql server user
  • sql server lock
  • Copy activity


Activity monitor in SSMS:

  • Active user task
  • Resource waiting
  • Data file I/O
  • Resource-intensive queries

T-SQL tools:

  • System Stored Procedure
  • Global variable
  • T-SQL statement
  • DBCC
  • Tracking mark
  • DMF/DMF


Sql Profiler, track and capture sqlserver events

  • Select the event to be tracked
  • Choose a tracking template
  • Select the data to be captured
  • Classify data meaningfully

Query analyzer

  • Show query execution plan
  • Show server trace
  • Display server-side statistics
  • Show client statistics

Database Engine Optimization Consultant

  • Analyze the bottleneck
  • Give suggestions for sql statements (index and statistics)



Guess you like

Origin blog.csdn.net/dinglang_2009/article/details/46480859