Presentation is loading. Please wait.

Presentation is loading. Please wait.

Collecting Performance Metrics

Similar presentations


Presentation on theme: "Collecting Performance Metrics"— Presentation transcript:

1 Collecting Performance Metrics
By Tracy Boggiano

2 About Me VOLUNTEER WORK SQL EXPERIENCE PASS INVOLVEMENT
19+ years experience on SQL Server dating back to 6.5 Idera Ace 2018 and Idera Superstar 2018 SQL EXPERIENCE Co-leader of SIG Advanced DBA of TriPass In Raleigh Leading getting Linux content in the existing Virtual Groups PASS INVOLVEMENT Founder of WeSpeakLinux.com Member of SpeakingMentors.com Volunteer with abused and neglected foster children through the NC Guardian ad Litem (volunteerforgal.org) also known as CASA nationwide (casaforchildren.org) VOLUNTEER WORK Tracy Boggiano Database Superhero Broadvine Database Superhero 2018

3 Agenda Why When What How Why When What How

4 Why Database Superhero 2018

5 Why Having Performance Metrics is Important
Understanding the trends in your environment You can find a problem before someone complains Proactive tuning Makes troubleshooting easier Capacity planning Understanding the trends in your environment You can find a problem before someone complains Proactive tuning Makes troubleshooting easier Capacity planning

6 Why Having Performance Metrics is Important
Gives you a baseline to show normal performance What’s the normal CPU Utilization How much memory is used for Buffer Pool vs. Plan Cache What is the PLE (Page Life Expectancy) Shows you abnormalities that need to be investigated CPU suddenly increases by 10% Is the Buffer Pool lower than normal or Plan Cache higher than normal PLE is lower than normal Gives you a baseline to show normal performance What’s the normal CPU Utilization How much memory is used for Buffer Pool vs. Plan Cache What is the PLE (Page Life Expectancy) Shows you abnormalities that need to be investigated CPU suddenly increases by 10% Is the Buffer Pool lower than normal or Plan Cache higher than normal PLE is lower than normal

7 When Database Superhero 2018

8 When Should You Collect Performance Metrics
All the time Collect samples on a regular interval such as every 30 seconds Some things that we don’t cover such as table space less frequently All the time Collect samples on a regular interval such as every 30 seconds Some things that we don’t cover such as table space less frequently

9 What Database Superhero 2018

10 What Systems Should You Collect Metrics On
Production is most important But your test environment is “production” to your developers Answer “ALL OF THEM” Production is most important But your test environment is “production” to your developers Answer “ALL OF THEM”

11 How Database Superhero 2018

12 sp_whoisactive Captures what is occurring now on the server
Can setup to capture to a table for later troubleshooting EXEC DBA.DBMaint.WhoIsActive @get_plans = 1, @get_full_inner_text = 1, @format_output = 0, @get_task_info = 2, @destination_table = 'dbo.WhoIsActiveOutput’; Setup a job to cleanup the data Captures what is occurring now on the server Can setup to capture to a table for later troubleshooting EXEC DBA.DBMaint.WhoIsActive @get_plans = 1, @get_full_inner_text = 1, @format_output = 0, @get_task_info = 2, @destination_table = 'dbo.WhoIsActiveOutput’; Setup a job to cleanup the data Kendra Little did a podcast on setting up to run with when an alert fires so you can run under certain conditions

13 Query Store Fix queries that have recently regressed
Identify top queries Audit the history of query plans for a given query Analyze the resource usage patterns for a particular database In 2017 It shows us wait stats for each query Auto plan correction Fix queries that have recently regressed Identify top queries Audit the history of query plans for a given query Analyze the resource usage patterns for a particular database In 2017 It shows us wait stats for each query Auto plan correction

14 For those who can’t upgrade to 2016/2017 (yet)
Open Query Store For those who can’t upgrade to 2016/ (yet) Come with reports integrate with SSMS Backwards compatible to 2008 Opensource For those who can’t upgrade to 2016/2017 (yet) Come with reports integrate with SSMS Backwards compatible to 2008 Opensource

15 Telegraf Solution Database Superhero 2018

16 InfluxDB Open Source Time Series Database
Name implies optimized for time-stamped or time series data So it’s created for storing monitoring data Tracks events tracked, monitored, downsampled, and aggregated over time This could be server metrics, application performance monitoring, network data, sensor data, events, clicks, trades in a market, and many other types of analytics data.  The key difference with time series data from regular data is that you’re always asking questions about it over time. A Time Series Database is built specifically for handling metrics and events or measurements that are time-stamped. A TSDB is optimized for measuring change over time. Open Source Time Series Database Name implies optimized for time-stamped or time series data So it’s created for storing monitoring data Tracks events tracked, monitored, downsampled, and aggregated over time

17 Grafana Provides a graphical interface for our data we are going to collect Very interactive Provides the ability to create alerts Provides the ability to add links to charts Provides a graphical interface for our data we are going to collect Very interactive Provides the ability to create alerts Provides the ability to add links to charts 20% improvement in CPU after turning on Query Store Auto Plan Correction

18 Telegraf Open Source Has many outputs (InfluxDB) Has many inputs
Cassandra Docker InfluxDB* Linux* MySQL PostgresSQL Redis SQL Server* Windows* *The ones we will take a look at

19 AzureDB: sys.dm_db_resource_stats
What Data is Collected AzureDB: sys.dm_db_resource_stats Database IO: sys.dm_io_virtual_file_stats Memory Clerk: sys.dm_os_memory_clerks Performance Counters: sys.dm_os_performance_counters Server properties Wait stats AzureDB: sys.dm_db_resource_stats Database IO: sys.dm_io_virtual_file_stats Memory Clerk: sys.dm_os_memory_clerks Performance Counters: sys.dm_os_performance_counters Server properties Wait stats Performance counters Activity – Transaction/sec, Batch requests/sec, blocked processes Availability Groups Log Activity Memory – PLE, Page Reads/Writes sec TempDB Resource Governor

20 Installation Database Superhero 2018

21 Install and Configure InfluxDB
Go to website and use commands for operating system Using Linux a few extra steps Start the service Set to auto start Add ports to firewall Create database Set retention policy Go to website and use commands for operating system Using Linux a few extra steps Start the service Set to auto start Add ports to firewall Create database Set retention policy

22 Install and Configure Grafana
Go to website and use commands for operating system Using Linux a few extra steps Start the service Set to auto start Add ports to firewall Add InfluxDB as data source Import dashboards Go to website and use commands for operating system Using Linux a few extra steps Start the service Set to auto start Add ports to firewall Add InfluxDB as data source Import dashboards

23 Setup a Login in SQL Server
Setup user on SQL Server USE master; GO CREATE LOGIN [telegraf] WITH PASSWORD = N'mystrongpassword'; GRANT VIEW SERVER STATE TO [telegraf]; GRANT VIEW ANY DEFINITION TO [telegraf]; Setup user on SQL Server USE master; GO CREATE LOGIN [telegraf] WITH PASSWORD = N'mystrongpassword'; GRANT VIEW SERVER STATE TO [telegraf]; GRANT VIEW ANY DEFINITION TO [telegraf];

24 How to Setup Telegraf Download from website from nightly builds ( egraf-nightly_windows_amd64.zip) Unzip to a network folder Later we will PowerShell to install on Windows Then let’s setup the config file(s) Download from website from nightly builds ( Unzip to a network folder Later we will PowerShell to install on Windows Then let’s setup the config file(s)

25 Demo Go through conf file Database Superhero 2018

26 Install Telegraf on SQL Server on Windows
PowerShell Script $servers 'server1', 'server2' ) $servers | % { Write-Host "$($_)..." New-Item -Path "\\$($_)\c$\Program Files\telegraf" -ItemType Directory -Force Copy-Item -Path "\\server\telegraf\telegraf.*" -Destination "\\$($_)\c$\Program Files\telegraf\" -Force Invoke-Command -ComputerName $_ -ScriptBlock { Stop-Service -Name telegraf -ErrorAction SilentlyContinue & "c:\program files\telegraf\telegraf.exe" --service install -config "c:\program files\telegraf\telegraf.conf" Start-Service -Name telegraf }

27 Install Telegraf on SQL Server on Linux
Go to website and use commands for operating system Using Linux a few extra steps Create config file Edit config file Start the service Set to auto start Go to website and use commands for operating system Using Linux a few extra steps Create config file Edit config file Start the service Set to auto start

28 Setup Grafana Datasource
Give it a Name Check off the Default box Change to InfluxDB Type Fill out your URL Then fill out your InfluxDB Details Save to test it Give it a Name Check off the Default box Change to InfluxDB Type Fill out your URL Then fill out your InfluxDB Details Save to test it

29 Setup Grafana Dashboards
Click on Dashboards then Import Copy and paste the JSON in the big box Rename the dashboard if so choose Then click Load All dashboards I use will be available for download Click on Dashboards then Import Copy and paste the JSON in the big box Rename the dashboard if so choose Then click Load All dashboards I use will be available for download

30 Demo Database Superhero 2018 Datasources
Check load dashboards and checkout stats Query Store Database Superhero 2018

31 Resource Governor

32 Resource Governor

33 Resource Governor

34 Demo What Interrupted My Nap One Saturday? #OnCallSelfie
Database Superhero 2018

35 The Page

36 Memory Clerk and PLE Buffer Pool Dropped 44 GBs
PLE Dropped from 19 hours to 0 ms

37 sp_whoisactive Output

38 #OnCallSelfie

39 Cost of Telegraf Setup InfluxDB is costing ~$3000 a year for ~500 servers (t4.micro in AWS) 8 CPUs 32 GBs RAM 600 GBs of disk space Grafana cost $5.26 a month on a year contract (t2.micro in AWS) 1 CPU 1 GB RAM No space requirements

40 Resources Capture sp_showisactive to table - Monitoring Performance By Using the Query Store databases/performance/monitoring-performance-by-using-the-query-store Open Query Store - Query Store Primer Presentation - store-primer/ Install SQL on Linux - connect-red-hat

41 Resources Telegraf Plugin - https://github.com/influxdata/telegraf/
InfluxDB – Grafana – Guide for Setting up Telegraf - telegraf SQLskills Waits Library - Wait Stats - views/sys-query-store-wait-stats-transact-sql Mark’s Announcement - Mark’s Podcasts on Resource Governor -

42 Questions?

43 Contact Info TWITTER @TracyBoggiano MY WEBSITE databasesuperhero.com


Download ppt "Collecting Performance Metrics"

Similar presentations


Ads by Google