Академический Документы
Профессиональный Документы
Культура Документы
net
http://ComunidadWindows.org
Session Objectives:
Get familiar with database performance tuning tools, especially what SQL Server 2008 offers Understand methodology of database performance bottleneck analysis Learn features/improvements of SQL Server 2008 that help improve performance
Invest in large scale, referenceable SQL Server projects across the world
Provide SQLCAT technical & project experience Conduct architecture and design reviews covering performance, operation, scalability and availability Offer use of HW lab in Redmond with direct access to SQL Server development team
System Performance Monitor (Perfmon) SQL Profiler Trace Dynamic Management Views/Functions DBCC commands SQLDiag (Shipped with SQL 2005/2008) SQLIO, SQLIOSim KernRate Debugging tools (Windbg, DebugDiag,) More
Data Collector & Management Data Warehouse (MDW) Extended Events Activity Monitor New DMVs/DMFs
MDW Host
Client Workstation
SSIS Pkgs
Collection Set Metadata Job Metadata
dcexec.exe
Cache Files
Management Studio
MDW Reports
SQL Agent
msdb
Time line
Navigation control
Resource usage
Reqource Governor
sys.dm_resource_governor_configuration sys.dm_resource_governor_resource_pools sys.dm_resource_governor_workload_groups
More
Bottleneck A point or component of a process where throughput is the slowest. Understanding where time is spent
Elapsed Time = Running + Waiting
System Reports
SQL Server Buffer Manager Object: (memory pressure could cause I/O pressure)
Buffer Cache hit ratio Page Life Expectancy Checkpoint pages/sec Lazywrites/sec
sys.dm_os_wait_stats sys.dm_exec_requests
pending/stalled I/O
sys.dm_io_pending_io_requests sys.dm_io_virtual_file_stats
2009-04-13 18:30:10.170 spid5s SQL Server has encountered 1 occurrence(s) of I/O requests taking longer than 15 seconds to complete on file [T:\tempdb\templog.ldf] in database [tempdb] (2). The OS file handle is 0x0000000000000670. The offset of the latest long I/O is: 0x000007eecac000 king longer than 15 seconds to complete on file [e:\myslowdb.mdf] in database [myslowdb] (1). The OS file handle is 0x00000438. The offset of the latest long IO is: 0x000000513ce000
Look if there is memory pressure Further narrow down to what queries are generating the I/O workload. Tune these queries. Explore data compression to reduce I/O load Upgrade storage hardware
Compress tables/indexes to reduce database size Compression ratio depends on schema & data distribution (avg 50-60%) Reduce query runtime I/O (increase cpu) Identify compression candidates
sp_estimate_data_compression_savings sys.dm_db_index_operational_stats
Resource Monitor/Task Manager Performance Monitor Counters System Data Collector Reports Windows Performance Toolkit (XPerf)
Monitor it Live Watch Live or Log counters you like Formatted Perfmon counter based report Dig deeper using ETW
Processor object:
%Privileged Time %Processor Time %User Time
New in SQL Server 2008 for Resource Governor feature
Sys.dm_exec_sessions
sys.dm_exec_requests
Sys.sysprocesses
cpu_time
cpu_time
total_worker_time
cpu
total_scheduled_tim e
total_elapsed_time
total_elapsed_time
total_elapsed_time
query_hash
Sql_handle/query_h ash
Extended Event can track individual statement level events like Profiler does with minimal impact ADD EVENT sqlserver.sql_statement_completed (action (sqlserver.sql_text) WHERE duration > 0), ADD EVENT sqlserver.sp_statement_completed (action (sqlserver.sql_text) WHERE duration > 0) select top 10 CONVERT(xml, event_data).value('(/event/data/value)[4]','int') as 'cpu'
High cpu doesnt necessarily mean its a problem. Drill down to specific workload and queries that drive cpu usage. Tune them. Use Resource Governor to protect high priority workloads Upgrade hardware
Resource Governor
allocate cpu/memory to prioritized workloads based on connection string parameters Mixed workloads: OLTP, Reporting, Maintenance
Soft Numa
Node configuration (soft numa node and cpu affinity) Network Configuration (soft numa node and tcp port)
AWE
32-bit uses AWE to cache data/index pages 64-bit uses AWE to implement Locked pages in memory
Process object:
Private bytes Virtual bytes Working set
SQL Server Plan Cache object SQL Server Resource Pool Stats object
sys.dm_os_process_memory
process_physical_memory_low = 1 indicates low physical memory. memory_utilization_percentage value below 100% indicates external memory pressure.
sys.dm_os_memory_clerks
sys.dm_os_ring_buffers
RING_BUFFER_SCHEDULER_MONITOR RING_BUFFER_RESOURCE_MONITOR RING_BUFFER_OOM RING_BUFFER_MEMORY_BROKER RING_BUFFER_BUFFER_POOL
Check memory configuration sp_configure External memory pressure Identify what other processes are competing Internal memory pressure Identify which SQL component is main consumer Workload/query tuning (sorting, hash join) Resource Governor Hardware upgrade
Focus on methodology no guess Correlate data points from multiple tools Performance tuning is iterative process bottleneck could move Resource contention impacts each other
Lack of memory -> high cpu & I/O Slow I/O -> tempdb contention