SlideShare a Scribd company logo
1 of 66
How to Make SQL Server Go Faster
© kCura LLC. All rights reserved.
Brent
Ozar
© kCura LLC. All rights reserved.
BrentOzar.com/go/fest2016
© kCura LLC. All rights reserved.
Pop quiz:
how fast is a “fast” car?
How hard is the engine working?How fast are we going?
0-60 time HP
VW Golf 7.8 170
How much weight are we carrying?
How much weight are we carrying?
0-60 time HP Weight,
KG
VW Golf 7.8 170 1,400
BMW X6 6.0 300 2,400
“We need to go faster.”
0-60 time HP Weight,
KG
VW Golf 7.8 170 1,400
VW GTI 5.8 220 1,400
BMW X6 6.0 300 2,400
BMW X6 M 3.9 555 2,400
“We need to go even faster.”
Bigger gains require
bigger changes.
Some compromises may be required.
0-60 time HP Weight,
KG
VW Golf 7.8 170 1,400
VW GTI 5.8 220 1,400
BMW X6 6.0 300 2,400
BMW X6 M 3.9 555 2,400
2007 Ariel Atom 3.0 245 650
© kCura LLC. All rights reserved.
To be a tuner,
you have to know your metrics.
© kCura LLC. All rights reserved.
• How much weight are we carrying around?
• How fast are can we get to 60mph?
• What bottleneck can we fix to go faster?
(Insufficient power, not enough grip, bad aerodynamics, etc.)
The 3 performance metrics
© kCura LLC. All rights reserved.
Pop quiz:
how fast is a “fast”
SQL Server?
© kCura LLC. All rights reserved.
Many of us have no idea.
© kCura LLC. All rights reserved.
• How much weight are we carrying?
• How fast are we going?
• How hard are we working to achieve that speed?
It’s time to get some answers.
© kCura LLC. All rights reserved.
• Rough guess: size of MDF/NDF data files on the server
• More accurate: used space in files. For each user database:
SELECT SUM(size)
FROM sys.database_files
WHERE type = 0;
• Over time for the past: backup sizes in msdb.dbo.backupfile
• In Relativity environments, chart the number of databases too
Total data size in GB/TB
© kCura LLC. All rights reserved.
• How much weight are we carrying?
Total data size in GB/TB,
and number of DBs.
• How fast are we going?:
• How hard are we working to achieve that speed?
It’s time to get some answers.
© kCura LLC. All rights reserved.
• Perfmon - SQLServer: SQL Statistics – Batch Requests/sec
• Not Transactions/sec
• Trend on an hourly basis and break it out by:
– Weekday vs weekend
– Business hours vs after hours
– Maintenance windows
(backups, DB maintenance)
How fast is your server going?
© kCura LLC. All rights reserved.
• Going up? More users, more API calls, new functionality in the
application
• Going down? Less users or API calls, or code has been
streamlined so more work is done in less queries
When Batch Requests/Sec changes
© kCura LLC. All rights reserved.
• 0 – 1,000 – easy to handle with commodity hardware.
• 1,000-5,000 – be careful, because one bad change to a
query can knock a commodity server over.
• 5,000-25,000 – if you’re growing, you should be making a
scale-out or caching plan.
• Over 25,000 – doable, but attention.
Batch Requests/Sec seen in the field
© kCura LLC. All rights reserved.
• How much weight are we carrying?
Total data size in GB/TB,
and number of DBs.
• How fast are we going?:
Batch Requests per second.
• How hard are we working to achieve that speed?
It’s time to get some answers.
© kCura LLC. All rights reserved.
How SQL Server Schedules CPU
© kCura LLC. All rights reserved.
How SQL Server Schedules CPU
© kCura LLC. All rights reserved.
How SQL Server Schedules CPU
© kCura LLC. All rights reserved.
How SQL Server Schedules CPU
© kCura LLC. All rights reserved.
How SQL Server Schedules CPU
© kCura LLC. All rights reserved.
• Resources:
CPU, memory, storage, network, latches, locks
• Stuff outside of SQL Server (Preemptive):
COM, OLEDB, CLR
• System Tasks:
Lazywriter, trace, full text search
SQL Server Waits For:
© kCura LLC. All rights reserved.
Is this SQL Server working hard?
© kCura LLC. All rights reserved.
What about this one?
© kCura LLC. All rights reserved.
Or this one?
© kCura LLC. All rights reserved.
Some queries are simple
© kCura LLC. All rights reserved.
Some queries have a lot going on
© kCura LLC. All rights reserved.
These were simple little queries
© kCura LLC. All rights reserved.
But one real-world query usually looks more like this
© kCura LLC. All rights reserved.
So for each core, on a busy server, you’ll likely see:
© kCura LLC. All rights reserved.
If we look like this for 1 second, how many seconds of waits?
© kCura LLC. All rights reserved.
Hours of wait time per hour
0
5
10
15
20
25
30
6:00 7:00 8:00 9:00 10:00 11:00
CPU
Locks
Storage
© kCura LLC. All rights reserved.
• Dynamic Management View (DMV) sys.dm_os_wait_stats
• Tracked cumulatively over time
• Trend on an hourly basis and break it out by:
– Weekday vs weekend
– Business hours vs after hours
– Maintenance windows
(backups, DB maintenance)
How hard is your server working?
© kCura LLC. All rights reserved.
• This metric is linked to Batch Requests:
the more work the server is asked to do, the more it waits.
• Going up? Batch Requests could be going up, or the server is responding slower to the existing
workload.
– Storage got slower, indexes were dropped, queries were tuned poorly, other processes are
running on the server
• Going down? Batch Requests could be too,
or server is responding faster to the workload.
– Indexes or queries were tuned,
more memory was added
When Wait Time changes
© kCura LLC. All rights reserved.
• 0 – Your server isn’t doing anything.
• 1 hour of waits – You’re still not doing much.
• Multiple hours per core – now we’re working!
And we should probably be tuning.
Wait Time per core per hour
© kCura LLC. All rights reserved.
• How much weight are we carrying?
Total data size in GB/TB,
and number of DBs.
• How fast are we going?:
Batch Requests per second.
• How hard are we working to achieve that speed?
Wait time per core per hour.
It’s time to get some answers.
© kCura LLC. All rights reserved.
sp_BlitzFirst
Your SQL Server’s dashboard
© kCura LLC. All rights reserved.
Quick snapshot: sp_BlitzFirst
• Free at BrentOzar.com/askbrent
• Totally free diagnostic tool by an amazingly hot guy.
• Installs in the master database.
• Runs in 5 seconds ideally, but can be more under load.
• By default, shows waits for a 5-second sample now.
• @SinceStartup = 1 shows waits since, uh, startup.
© kCura LLC. All rights reserved.
sp_BlitzFirst @SinceStartup = 1
If the top wait is… Then SQL Server is
waiting on…
Tuning options
CXPACKET Parallelism Set Cost Threshold
and Maxdop, identify
expensive queries,
tune indexes
PAGEIOLATCH Reading data pages
from disk
Add memory, tune
indexes, tune storage
SOS_SCHEDULER_
YIELD
CPU cycles Tune indexes, add
CPU power
WRITELOG Writing to the
transaction log
Tune storage, move
logs onto SSD
© kCura LLC. All rights reserved.
• First, set the following server-level configuration settings per kCura’s optimization guide:
– Cost Threshold for Parallelism = 50
– MAXDOP = the number of cores in one CPU, up to 8
• Identify which queries are doing the most reads:
– sp_BlitzCache @SortOrder = 'reads'
– If they’re searches, work with the authors to reduce their impact
– If they’re Relativity queries (or heaven forbid, your own or 3rd party apps), index them
• I don’t mean defragment your indexes: that won’t help here. I mean design new indexes.
CXPACKET: queries are going parallel
© kCura LLC. All rights reserved.
• Yes, you can actually tune indexes in Relativity databases
– On transactional tables, aim for 5 or less indexes per table, 5 or less fields per index
– Document can be an exception, but remember:
the more you index, the slower deletes/updates/inserts (DUIs) go
– Prefix your own indexes with company initials, like BOU_Field1_Field2
• Health check on your indexes: sp_BlitzIndex @GetAllDatabases = 1
– Indexes not in use: these are just slowing down DUIs
– Missing indexes: these would have made queries go faster
CXPACKET: indexing to reduce reads
© kCura LLC. All rights reserved.
• Say you need to search a 50GB Document table, and it’s not in memory
• Say your storage reads 1GB per second
• Your search will take at least 50 seconds
PAGEIOLATCH: reading data pages from a data file
© kCura LLC. All rights reserved.
• Say you need to search a 50GB Document table, and it’s not in memory
• Say your storage reads 1GB per second
• Your search will take at least 50 seconds
• But say you cache that entire Document table in memory:
your query will run as fast as SQL Server can scan memory (which could be 4-5 seconds)
• Tuning storage is hard and time-consuming,
but adding memory is fast and cheap
PAGEIOLATCH: reading data pages from a data file
© kCura LLC. All rights reserved.
• If you’ve got less than 256GB, put memory in the box
• Identify which queries are doing the most reads:
– sp_BlitzCache @SortOrder = 'reads'
– If they’re searches, work with the authors to reduce their impact
– If they’re Relativity queries (or heaven forbid, your own or 3rd party apps), index them
• Measure your storage speed with CrystalDiskMark: BrentOzar.com/go/cdm
– SQL Server’s Minimum Consumption Rate (MCR): 200MB/sec reads, per core
PAGEIOLATCH fixes
© kCura LLC. All rights reserved.
• First, identify whether you’re maxing out all of your cores, or just 1-2 of them at a time
• If it’s just one, single-threaded queries need more CPU power (but additional cores won’t help)
SOS_SCHEDULER_YIELD: a query needs more CPU time
© kCura LLC. All rights reserved.
• Run CPU-Z from CPUID.com
• Compare these two numbers:
– Specification: how fast it should go
– Core speed: how fast it’s going
• If core speed is lower, check your Windows,
hypervisor, and BIOS power saving settings.
Use High Performance, not Balanced.
• You usually have to set this at all 3 levels:
Windows, hypervisor, and BIOS.
SOS_SCHEDULER_YIELD easy fix: powering up
© kCura LLC. All rights reserved.
• Identify which queries are burning the most CPU cycles:
– sp_BlitzCache @SortOrder = 'CPU'
– If they’re searches, work with the authors to reduce their impact
– If they’re Relativity queries (or heaven forbid, your own or 3rd party apps), index them
SOS_SCHEDULER_YIELD harder fix: tune queries, indexes
© kCura LLC. All rights reserved.
• Identify your processor name, like Intel Xeon 5160
• Go to Wikipedia (yes, seriously):
https://en.wikipedia.org/wiki/
List_of_Intel_Xeon_microprocessors
• Hit control-F, type in your model number
• Look for faster processors in the same family,
which will usually be drop-in replacements
• Same number of cores = same licensing
• Try to avoid adding cores: your licensing goes up,
so you’re better off splitting workspaces into
more SQL Servers, each with their own RAM
SOS_SCHEDULER_YIELD: throwing hardware at it
© kCura LLC. All rights reserved.
• When you delete/update/insert records, SQL Server:
– Writes to the transaction log before your transaction is committed
– Writes the data file contents later, asynchronously
– This means data file write speeds matter less than you might expect,
but log file speed is super-important to loading documents
• Performance Monitor counter: Physical Disk: Avg Sec/Write (aka write latency)
– Reported in whole seconds – use 3 decimal places for MS.
– Microsoft says >3 milliseconds log writes are slow. Me: 20.
• Related counters: Physical Disk: Reads/sec, Writes/sec show how much SQL is asking for
• The more we ask storage to work, the slower it’ll get.
WRITELOG: writing to the transaction log file during DUIs
© kCura LLC. All rights reserved.
Recap
© kCura LLC. All rights reserved.
Know your top wait type.
• Performance tuners know these 3 metrics:
1. Total database size (and quantity)
2. Batch Requests/Second
3. Wait Time per Core per Hour (or per sec)
• Capture the metrics with sp_BlitzFirst.
• Your top wait stat is where to focus your tuning.
© kCura LLC. All rights reserved.
sp_BlitzFirst @SinceStartup = 1
If the top wait is… Then SQL Server is
waiting on…
Tuning options
CXPACKET Parallelism Set Cost Threshold
and Maxdop, identify
expensive queries,
tune indexes
PAGEIOLATCH Reading data pages
from disk
Add memory, tune
indexes, tune storage
SOS_SCHEDULER_
YIELD
CPU cycles Tune indexes, add
CPU power
WRITELOG Writing to the
transaction log
Tune storage, move
logs onto SSD
Let Us Know What You Think
You’ll receive a short survey via email for
each breakout session and the overall event.
Please take a minute to tell us what you think.

More Related Content

What's hot

Four Ways to Improve ASP .NET Performance and Scalability
 Four Ways to Improve ASP .NET Performance and Scalability Four Ways to Improve ASP .NET Performance and Scalability
Four Ways to Improve ASP .NET Performance and ScalabilityAlachisoft
 
Ultimate Free SQL Server Toolkit
Ultimate Free SQL Server ToolkitUltimate Free SQL Server Toolkit
Ultimate Free SQL Server ToolkitKevin Kline
 
Scaling asp.net websites to millions of users
Scaling asp.net websites to millions of usersScaling asp.net websites to millions of users
Scaling asp.net websites to millions of usersoazabir
 
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...Knut Relbe-Moe [MVP, MCT]
 
Database Configuration for Maximum SharePoint 2010 Performance
Database Configuration for Maximum SharePoint 2010 PerformanceDatabase Configuration for Maximum SharePoint 2010 Performance
Database Configuration for Maximum SharePoint 2010 PerformanceEdwin M Sarmiento
 
Wordpress optimization
Wordpress optimizationWordpress optimization
Wordpress optimizationAlmog Baku
 
Microsoft Azure Web Sites Performance Analysis Lessons Learned
Microsoft Azure Web Sites Performance Analysis Lessons LearnedMicrosoft Azure Web Sites Performance Analysis Lessons Learned
Microsoft Azure Web Sites Performance Analysis Lessons LearnedChris Woodill
 
Orlando DNN Usergroup Pres 12/06/11
Orlando DNN Usergroup Pres 12/06/11Orlando DNN Usergroup Pres 12/06/11
Orlando DNN Usergroup Pres 12/06/11Jess Coburn
 
Scalable Web Arch
Scalable Web ArchScalable Web Arch
Scalable Web Archroyans
 
Backup and Restore SQL Server Databases in Microsoft Azure
Backup and Restore SQL Server Databases in Microsoft AzureBackup and Restore SQL Server Databases in Microsoft Azure
Backup and Restore SQL Server Databases in Microsoft AzureDatavail
 
SPSMadrid Get sql spinning with SharePoint. Best practice for the back end
SPSMadrid Get sql spinning with SharePoint. Best practice for the back endSPSMadrid Get sql spinning with SharePoint. Best practice for the back end
SPSMadrid Get sql spinning with SharePoint. Best practice for the back endKnut Relbe-Moe [MVP, MCT]
 
End-to-end Troubleshooting Checklist for Microsoft SQL Server
End-to-end Troubleshooting Checklist for Microsoft SQL ServerEnd-to-end Troubleshooting Checklist for Microsoft SQL Server
End-to-end Troubleshooting Checklist for Microsoft SQL ServerKevin Kline
 
Web Speed And Scalability
Web Speed And ScalabilityWeb Speed And Scalability
Web Speed And ScalabilityJason Ragsdale
 
KoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbegan
KoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbeganKoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbegan
KoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbeganTobias Koprowski
 
PASS VC: SQL Server Performance Monitoring and Baselining
PASS VC: SQL Server Performance Monitoring and BaseliningPASS VC: SQL Server Performance Monitoring and Baselining
PASS VC: SQL Server Performance Monitoring and BaseliningPARIKSHIT SAVJANI
 
Amazon RDS for MySQL: Best Practices and Migration
Amazon RDS for MySQL: Best Practices and MigrationAmazon RDS for MySQL: Best Practices and Migration
Amazon RDS for MySQL: Best Practices and MigrationAmazon Web Services
 

What's hot (20)

Four Ways to Improve ASP .NET Performance and Scalability
 Four Ways to Improve ASP .NET Performance and Scalability Four Ways to Improve ASP .NET Performance and Scalability
Four Ways to Improve ASP .NET Performance and Scalability
 
Ultimate Free SQL Server Toolkit
Ultimate Free SQL Server ToolkitUltimate Free SQL Server Toolkit
Ultimate Free SQL Server Toolkit
 
Scaling asp.net websites to millions of users
Scaling asp.net websites to millions of usersScaling asp.net websites to millions of users
Scaling asp.net websites to millions of users
 
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
 
No sql preview
No sql previewNo sql preview
No sql preview
 
Database Configuration for Maximum SharePoint 2010 Performance
Database Configuration for Maximum SharePoint 2010 PerformanceDatabase Configuration for Maximum SharePoint 2010 Performance
Database Configuration for Maximum SharePoint 2010 Performance
 
Wordpress optimization
Wordpress optimizationWordpress optimization
Wordpress optimization
 
Microsoft Azure Web Sites Performance Analysis Lessons Learned
Microsoft Azure Web Sites Performance Analysis Lessons LearnedMicrosoft Azure Web Sites Performance Analysis Lessons Learned
Microsoft Azure Web Sites Performance Analysis Lessons Learned
 
Orlando DNN Usergroup Pres 12/06/11
Orlando DNN Usergroup Pres 12/06/11Orlando DNN Usergroup Pres 12/06/11
Orlando DNN Usergroup Pres 12/06/11
 
Scalable Web Arch
Scalable Web ArchScalable Web Arch
Scalable Web Arch
 
Backup and Restore SQL Server Databases in Microsoft Azure
Backup and Restore SQL Server Databases in Microsoft AzureBackup and Restore SQL Server Databases in Microsoft Azure
Backup and Restore SQL Server Databases in Microsoft Azure
 
SPSMadrid Get sql spinning with SharePoint. Best practice for the back end
SPSMadrid Get sql spinning with SharePoint. Best practice for the back endSPSMadrid Get sql spinning with SharePoint. Best practice for the back end
SPSMadrid Get sql spinning with SharePoint. Best practice for the back end
 
End-to-end Troubleshooting Checklist for Microsoft SQL Server
End-to-end Troubleshooting Checklist for Microsoft SQL ServerEnd-to-end Troubleshooting Checklist for Microsoft SQL Server
End-to-end Troubleshooting Checklist for Microsoft SQL Server
 
Web Speed And Scalability
Web Speed And ScalabilityWeb Speed And Scalability
Web Speed And Scalability
 
KoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbegan
KoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbeganKoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbegan
KoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbegan
 
PASS Summit 2020
PASS Summit 2020PASS Summit 2020
PASS Summit 2020
 
PASS VC: SQL Server Performance Monitoring and Baselining
PASS VC: SQL Server Performance Monitoring and BaseliningPASS VC: SQL Server Performance Monitoring and Baselining
PASS VC: SQL Server Performance Monitoring and Baselining
 
Amazon RDS for MySQL: Best Practices and Migration
Amazon RDS for MySQL: Best Practices and MigrationAmazon RDS for MySQL: Best Practices and Migration
Amazon RDS for MySQL: Best Practices and Migration
 
Azure Databases with IaaS
Azure Databases with IaaSAzure Databases with IaaS
Azure Databases with IaaS
 
Caching Strategies
Caching StrategiesCaching Strategies
Caching Strategies
 

Similar to How to Make SQL Server Go Faster

Leveraging Databricks for Spark Pipelines
Leveraging Databricks for Spark PipelinesLeveraging Databricks for Spark Pipelines
Leveraging Databricks for Spark PipelinesRose Toomey
 
Leveraging Databricks for Spark pipelines
Leveraging Databricks for Spark pipelinesLeveraging Databricks for Spark pipelines
Leveraging Databricks for Spark pipelinesRose Toomey
 
Strata London 2019 Scaling Impala.pptx
Strata London 2019 Scaling Impala.pptxStrata London 2019 Scaling Impala.pptx
Strata London 2019 Scaling Impala.pptxManish Maheshwari
 
Strata London 2019 Scaling Impala
Strata London 2019 Scaling ImpalaStrata London 2019 Scaling Impala
Strata London 2019 Scaling ImpalaManish Maheshwari
 
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast DataDatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast DataHakka Labs
 
(ATS4-PLAT08) Server Pool Management
(ATS4-PLAT08) Server Pool Management(ATS4-PLAT08) Server Pool Management
(ATS4-PLAT08) Server Pool ManagementBIOVIA
 
To Cloud or Not To Cloud?
To Cloud or Not To Cloud?To Cloud or Not To Cloud?
To Cloud or Not To Cloud?Greg Lindahl
 
(ATS6-PLAT06) Maximizing AEP Performance
(ATS6-PLAT06) Maximizing AEP Performance(ATS6-PLAT06) Maximizing AEP Performance
(ATS6-PLAT06) Maximizing AEP PerformanceBIOVIA
 
Power Saturday 2019 B6 - SQL Server installation cookbook
Power Saturday 2019 B6 - SQL Server installation cookbookPower Saturday 2019 B6 - SQL Server installation cookbook
Power Saturday 2019 B6 - SQL Server installation cookbookPowerSaturdayParis
 
SQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should KnowSQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should KnowDean Richards
 
Datadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/DayDatadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/DayC4Media
 
Healthcare Claim Reimbursement using Apache Spark
Healthcare Claim Reimbursement using Apache SparkHealthcare Claim Reimbursement using Apache Spark
Healthcare Claim Reimbursement using Apache SparkDatabricks
 
Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive

Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive

Cloudera, Inc.
 
Scaling apps for the big time
Scaling apps for the big timeScaling apps for the big time
Scaling apps for the big timeproitconsult
 
Webinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance TuningWebinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance TuningSeveralnines
 

Similar to How to Make SQL Server Go Faster (20)

Performance tuning in sql server
Performance tuning in sql serverPerformance tuning in sql server
Performance tuning in sql server
 
Leveraging Databricks for Spark Pipelines
Leveraging Databricks for Spark PipelinesLeveraging Databricks for Spark Pipelines
Leveraging Databricks for Spark Pipelines
 
Leveraging Databricks for Spark pipelines
Leveraging Databricks for Spark pipelinesLeveraging Databricks for Spark pipelines
Leveraging Databricks for Spark pipelines
 
Strata London 2019 Scaling Impala.pptx
Strata London 2019 Scaling Impala.pptxStrata London 2019 Scaling Impala.pptx
Strata London 2019 Scaling Impala.pptx
 
Strata London 2019 Scaling Impala
Strata London 2019 Scaling ImpalaStrata London 2019 Scaling Impala
Strata London 2019 Scaling Impala
 
Breaking data
Breaking dataBreaking data
Breaking data
 
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast DataDatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
 
(ATS4-PLAT08) Server Pool Management
(ATS4-PLAT08) Server Pool Management(ATS4-PLAT08) Server Pool Management
(ATS4-PLAT08) Server Pool Management
 
Spark Tips & Tricks
Spark Tips & TricksSpark Tips & Tricks
Spark Tips & Tricks
 
Kudu austin oct 2015.pptx
Kudu austin oct 2015.pptxKudu austin oct 2015.pptx
Kudu austin oct 2015.pptx
 
To Cloud or Not To Cloud?
To Cloud or Not To Cloud?To Cloud or Not To Cloud?
To Cloud or Not To Cloud?
 
(ATS6-PLAT06) Maximizing AEP Performance
(ATS6-PLAT06) Maximizing AEP Performance(ATS6-PLAT06) Maximizing AEP Performance
(ATS6-PLAT06) Maximizing AEP Performance
 
Fastest Servlets in the West
Fastest Servlets in the WestFastest Servlets in the West
Fastest Servlets in the West
 
Power Saturday 2019 B6 - SQL Server installation cookbook
Power Saturday 2019 B6 - SQL Server installation cookbookPower Saturday 2019 B6 - SQL Server installation cookbook
Power Saturday 2019 B6 - SQL Server installation cookbook
 
SQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should KnowSQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should Know
 
Datadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/DayDatadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/Day
 
Healthcare Claim Reimbursement using Apache Spark
Healthcare Claim Reimbursement using Apache SparkHealthcare Claim Reimbursement using Apache Spark
Healthcare Claim Reimbursement using Apache Spark
 
Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive

Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive


 
Scaling apps for the big time
Scaling apps for the big timeScaling apps for the big time
Scaling apps for the big time
 
Webinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance TuningWebinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance Tuning
 

More from Brent Ozar

Fundamentals of TempDB
Fundamentals of TempDBFundamentals of TempDB
Fundamentals of TempDBBrent Ozar
 
Fundamentals of Columnstore - Introductions
Fundamentals of Columnstore - IntroductionsFundamentals of Columnstore - Introductions
Fundamentals of Columnstore - IntroductionsBrent Ozar
 
Top 10 Developer Mistakes That Won't Scale with SQL Server
Top 10 Developer Mistakes That Won't Scale with SQL ServerTop 10 Developer Mistakes That Won't Scale with SQL Server
Top 10 Developer Mistakes That Won't Scale with SQL ServerBrent Ozar
 
Deadlocks: Lets Do One, Understand It, and Fix It
Deadlocks: Lets Do One, Understand It, and Fix ItDeadlocks: Lets Do One, Understand It, and Fix It
Deadlocks: Lets Do One, Understand It, and Fix ItBrent Ozar
 
Help! SQL Server 2008 is Still Here!
Help! SQL Server 2008 is Still Here!Help! SQL Server 2008 is Still Here!
Help! SQL Server 2008 is Still Here!Brent Ozar
 
An Introduction to GitHub for DBAs - Brent Ozar
An Introduction to GitHub for DBAs - Brent OzarAn Introduction to GitHub for DBAs - Brent Ozar
An Introduction to GitHub for DBAs - Brent OzarBrent Ozar
 
SQL Query Optimization: Why Is It So Hard to Get Right?
SQL Query Optimization: Why Is It So Hard to Get Right?SQL Query Optimization: Why Is It So Hard to Get Right?
SQL Query Optimization: Why Is It So Hard to Get Right?Brent Ozar
 
Headaches of Blocking, Locking, and Deadlocking
Headaches of Blocking, Locking, and DeadlockingHeadaches of Blocking, Locking, and Deadlocking
Headaches of Blocking, Locking, and DeadlockingBrent Ozar
 
"But It Worked In Development!" - 3 Hard SQL Server Problems
"But It Worked In Development!" - 3 Hard SQL Server Problems"But It Worked In Development!" - 3 Hard SQL Server Problems
"But It Worked In Development!" - 3 Hard SQL Server ProblemsBrent Ozar
 
Columnstore Customer Stories 2016 by Sunil Agarwal
Columnstore Customer Stories 2016 by Sunil AgarwalColumnstore Customer Stories 2016 by Sunil Agarwal
Columnstore Customer Stories 2016 by Sunil AgarwalBrent Ozar
 
500-Level Guide to Career Internals
500-Level Guide to Career Internals500-Level Guide to Career Internals
500-Level Guide to Career InternalsBrent Ozar
 
500-Level Guide to Career Internals
500-Level Guide to Career Internals500-Level Guide to Career Internals
500-Level Guide to Career InternalsBrent Ozar
 

More from Brent Ozar (12)

Fundamentals of TempDB
Fundamentals of TempDBFundamentals of TempDB
Fundamentals of TempDB
 
Fundamentals of Columnstore - Introductions
Fundamentals of Columnstore - IntroductionsFundamentals of Columnstore - Introductions
Fundamentals of Columnstore - Introductions
 
Top 10 Developer Mistakes That Won't Scale with SQL Server
Top 10 Developer Mistakes That Won't Scale with SQL ServerTop 10 Developer Mistakes That Won't Scale with SQL Server
Top 10 Developer Mistakes That Won't Scale with SQL Server
 
Deadlocks: Lets Do One, Understand It, and Fix It
Deadlocks: Lets Do One, Understand It, and Fix ItDeadlocks: Lets Do One, Understand It, and Fix It
Deadlocks: Lets Do One, Understand It, and Fix It
 
Help! SQL Server 2008 is Still Here!
Help! SQL Server 2008 is Still Here!Help! SQL Server 2008 is Still Here!
Help! SQL Server 2008 is Still Here!
 
An Introduction to GitHub for DBAs - Brent Ozar
An Introduction to GitHub for DBAs - Brent OzarAn Introduction to GitHub for DBAs - Brent Ozar
An Introduction to GitHub for DBAs - Brent Ozar
 
SQL Query Optimization: Why Is It So Hard to Get Right?
SQL Query Optimization: Why Is It So Hard to Get Right?SQL Query Optimization: Why Is It So Hard to Get Right?
SQL Query Optimization: Why Is It So Hard to Get Right?
 
Headaches of Blocking, Locking, and Deadlocking
Headaches of Blocking, Locking, and DeadlockingHeadaches of Blocking, Locking, and Deadlocking
Headaches of Blocking, Locking, and Deadlocking
 
"But It Worked In Development!" - 3 Hard SQL Server Problems
"But It Worked In Development!" - 3 Hard SQL Server Problems"But It Worked In Development!" - 3 Hard SQL Server Problems
"But It Worked In Development!" - 3 Hard SQL Server Problems
 
Columnstore Customer Stories 2016 by Sunil Agarwal
Columnstore Customer Stories 2016 by Sunil AgarwalColumnstore Customer Stories 2016 by Sunil Agarwal
Columnstore Customer Stories 2016 by Sunil Agarwal
 
500-Level Guide to Career Internals
500-Level Guide to Career Internals500-Level Guide to Career Internals
500-Level Guide to Career Internals
 
500-Level Guide to Career Internals
500-Level Guide to Career Internals500-Level Guide to Career Internals
500-Level Guide to Career Internals
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

How to Make SQL Server Go Faster

  • 1. How to Make SQL Server Go Faster
  • 2. © kCura LLC. All rights reserved. Brent Ozar
  • 3. © kCura LLC. All rights reserved. BrentOzar.com/go/fest2016
  • 4. © kCura LLC. All rights reserved. Pop quiz: how fast is a “fast” car?
  • 5. How hard is the engine working?How fast are we going?
  • 6. 0-60 time HP VW Golf 7.8 170
  • 7. How much weight are we carrying?
  • 8. How much weight are we carrying?
  • 9. 0-60 time HP Weight, KG VW Golf 7.8 170 1,400 BMW X6 6.0 300 2,400
  • 10. “We need to go faster.”
  • 11. 0-60 time HP Weight, KG VW Golf 7.8 170 1,400 VW GTI 5.8 220 1,400 BMW X6 6.0 300 2,400 BMW X6 M 3.9 555 2,400
  • 12. “We need to go even faster.”
  • 14. Some compromises may be required.
  • 15. 0-60 time HP Weight, KG VW Golf 7.8 170 1,400 VW GTI 5.8 220 1,400 BMW X6 6.0 300 2,400 BMW X6 M 3.9 555 2,400 2007 Ariel Atom 3.0 245 650
  • 16. © kCura LLC. All rights reserved. To be a tuner, you have to know your metrics.
  • 17. © kCura LLC. All rights reserved. • How much weight are we carrying around? • How fast are can we get to 60mph? • What bottleneck can we fix to go faster? (Insufficient power, not enough grip, bad aerodynamics, etc.) The 3 performance metrics
  • 18. © kCura LLC. All rights reserved. Pop quiz: how fast is a “fast” SQL Server?
  • 19. © kCura LLC. All rights reserved. Many of us have no idea.
  • 20. © kCura LLC. All rights reserved. • How much weight are we carrying? • How fast are we going? • How hard are we working to achieve that speed? It’s time to get some answers.
  • 21. © kCura LLC. All rights reserved. • Rough guess: size of MDF/NDF data files on the server • More accurate: used space in files. For each user database: SELECT SUM(size) FROM sys.database_files WHERE type = 0; • Over time for the past: backup sizes in msdb.dbo.backupfile • In Relativity environments, chart the number of databases too Total data size in GB/TB
  • 22. © kCura LLC. All rights reserved. • How much weight are we carrying? Total data size in GB/TB, and number of DBs. • How fast are we going?: • How hard are we working to achieve that speed? It’s time to get some answers.
  • 23. © kCura LLC. All rights reserved. • Perfmon - SQLServer: SQL Statistics – Batch Requests/sec • Not Transactions/sec • Trend on an hourly basis and break it out by: – Weekday vs weekend – Business hours vs after hours – Maintenance windows (backups, DB maintenance) How fast is your server going?
  • 24. © kCura LLC. All rights reserved. • Going up? More users, more API calls, new functionality in the application • Going down? Less users or API calls, or code has been streamlined so more work is done in less queries When Batch Requests/Sec changes
  • 25. © kCura LLC. All rights reserved. • 0 – 1,000 – easy to handle with commodity hardware. • 1,000-5,000 – be careful, because one bad change to a query can knock a commodity server over. • 5,000-25,000 – if you’re growing, you should be making a scale-out or caching plan. • Over 25,000 – doable, but attention. Batch Requests/Sec seen in the field
  • 26. © kCura LLC. All rights reserved. • How much weight are we carrying? Total data size in GB/TB, and number of DBs. • How fast are we going?: Batch Requests per second. • How hard are we working to achieve that speed? It’s time to get some answers.
  • 27. © kCura LLC. All rights reserved. How SQL Server Schedules CPU
  • 28. © kCura LLC. All rights reserved. How SQL Server Schedules CPU
  • 29. © kCura LLC. All rights reserved. How SQL Server Schedules CPU
  • 30. © kCura LLC. All rights reserved. How SQL Server Schedules CPU
  • 31. © kCura LLC. All rights reserved. How SQL Server Schedules CPU
  • 32. © kCura LLC. All rights reserved. • Resources: CPU, memory, storage, network, latches, locks • Stuff outside of SQL Server (Preemptive): COM, OLEDB, CLR • System Tasks: Lazywriter, trace, full text search SQL Server Waits For:
  • 33. © kCura LLC. All rights reserved. Is this SQL Server working hard?
  • 34. © kCura LLC. All rights reserved. What about this one?
  • 35. © kCura LLC. All rights reserved. Or this one?
  • 36. © kCura LLC. All rights reserved. Some queries are simple
  • 37. © kCura LLC. All rights reserved. Some queries have a lot going on
  • 38. © kCura LLC. All rights reserved. These were simple little queries
  • 39. © kCura LLC. All rights reserved. But one real-world query usually looks more like this
  • 40. © kCura LLC. All rights reserved. So for each core, on a busy server, you’ll likely see:
  • 41. © kCura LLC. All rights reserved. If we look like this for 1 second, how many seconds of waits?
  • 42. © kCura LLC. All rights reserved. Hours of wait time per hour 0 5 10 15 20 25 30 6:00 7:00 8:00 9:00 10:00 11:00 CPU Locks Storage
  • 43. © kCura LLC. All rights reserved. • Dynamic Management View (DMV) sys.dm_os_wait_stats • Tracked cumulatively over time • Trend on an hourly basis and break it out by: – Weekday vs weekend – Business hours vs after hours – Maintenance windows (backups, DB maintenance) How hard is your server working?
  • 44. © kCura LLC. All rights reserved. • This metric is linked to Batch Requests: the more work the server is asked to do, the more it waits. • Going up? Batch Requests could be going up, or the server is responding slower to the existing workload. – Storage got slower, indexes were dropped, queries were tuned poorly, other processes are running on the server • Going down? Batch Requests could be too, or server is responding faster to the workload. – Indexes or queries were tuned, more memory was added When Wait Time changes
  • 45. © kCura LLC. All rights reserved. • 0 – Your server isn’t doing anything. • 1 hour of waits – You’re still not doing much. • Multiple hours per core – now we’re working! And we should probably be tuning. Wait Time per core per hour
  • 46. © kCura LLC. All rights reserved. • How much weight are we carrying? Total data size in GB/TB, and number of DBs. • How fast are we going?: Batch Requests per second. • How hard are we working to achieve that speed? Wait time per core per hour. It’s time to get some answers.
  • 47. © kCura LLC. All rights reserved. sp_BlitzFirst Your SQL Server’s dashboard
  • 48. © kCura LLC. All rights reserved. Quick snapshot: sp_BlitzFirst • Free at BrentOzar.com/askbrent • Totally free diagnostic tool by an amazingly hot guy. • Installs in the master database. • Runs in 5 seconds ideally, but can be more under load. • By default, shows waits for a 5-second sample now. • @SinceStartup = 1 shows waits since, uh, startup.
  • 49.
  • 50.
  • 51. © kCura LLC. All rights reserved. sp_BlitzFirst @SinceStartup = 1 If the top wait is… Then SQL Server is waiting on… Tuning options CXPACKET Parallelism Set Cost Threshold and Maxdop, identify expensive queries, tune indexes PAGEIOLATCH Reading data pages from disk Add memory, tune indexes, tune storage SOS_SCHEDULER_ YIELD CPU cycles Tune indexes, add CPU power WRITELOG Writing to the transaction log Tune storage, move logs onto SSD
  • 52. © kCura LLC. All rights reserved. • First, set the following server-level configuration settings per kCura’s optimization guide: – Cost Threshold for Parallelism = 50 – MAXDOP = the number of cores in one CPU, up to 8 • Identify which queries are doing the most reads: – sp_BlitzCache @SortOrder = 'reads' – If they’re searches, work with the authors to reduce their impact – If they’re Relativity queries (or heaven forbid, your own or 3rd party apps), index them • I don’t mean defragment your indexes: that won’t help here. I mean design new indexes. CXPACKET: queries are going parallel
  • 53.
  • 54. © kCura LLC. All rights reserved. • Yes, you can actually tune indexes in Relativity databases – On transactional tables, aim for 5 or less indexes per table, 5 or less fields per index – Document can be an exception, but remember: the more you index, the slower deletes/updates/inserts (DUIs) go – Prefix your own indexes with company initials, like BOU_Field1_Field2 • Health check on your indexes: sp_BlitzIndex @GetAllDatabases = 1 – Indexes not in use: these are just slowing down DUIs – Missing indexes: these would have made queries go faster CXPACKET: indexing to reduce reads
  • 55. © kCura LLC. All rights reserved. • Say you need to search a 50GB Document table, and it’s not in memory • Say your storage reads 1GB per second • Your search will take at least 50 seconds PAGEIOLATCH: reading data pages from a data file
  • 56. © kCura LLC. All rights reserved. • Say you need to search a 50GB Document table, and it’s not in memory • Say your storage reads 1GB per second • Your search will take at least 50 seconds • But say you cache that entire Document table in memory: your query will run as fast as SQL Server can scan memory (which could be 4-5 seconds) • Tuning storage is hard and time-consuming, but adding memory is fast and cheap PAGEIOLATCH: reading data pages from a data file
  • 57. © kCura LLC. All rights reserved. • If you’ve got less than 256GB, put memory in the box • Identify which queries are doing the most reads: – sp_BlitzCache @SortOrder = 'reads' – If they’re searches, work with the authors to reduce their impact – If they’re Relativity queries (or heaven forbid, your own or 3rd party apps), index them • Measure your storage speed with CrystalDiskMark: BrentOzar.com/go/cdm – SQL Server’s Minimum Consumption Rate (MCR): 200MB/sec reads, per core PAGEIOLATCH fixes
  • 58. © kCura LLC. All rights reserved. • First, identify whether you’re maxing out all of your cores, or just 1-2 of them at a time • If it’s just one, single-threaded queries need more CPU power (but additional cores won’t help) SOS_SCHEDULER_YIELD: a query needs more CPU time
  • 59. © kCura LLC. All rights reserved. • Run CPU-Z from CPUID.com • Compare these two numbers: – Specification: how fast it should go – Core speed: how fast it’s going • If core speed is lower, check your Windows, hypervisor, and BIOS power saving settings. Use High Performance, not Balanced. • You usually have to set this at all 3 levels: Windows, hypervisor, and BIOS. SOS_SCHEDULER_YIELD easy fix: powering up
  • 60. © kCura LLC. All rights reserved. • Identify which queries are burning the most CPU cycles: – sp_BlitzCache @SortOrder = 'CPU' – If they’re searches, work with the authors to reduce their impact – If they’re Relativity queries (or heaven forbid, your own or 3rd party apps), index them SOS_SCHEDULER_YIELD harder fix: tune queries, indexes
  • 61. © kCura LLC. All rights reserved. • Identify your processor name, like Intel Xeon 5160 • Go to Wikipedia (yes, seriously): https://en.wikipedia.org/wiki/ List_of_Intel_Xeon_microprocessors • Hit control-F, type in your model number • Look for faster processors in the same family, which will usually be drop-in replacements • Same number of cores = same licensing • Try to avoid adding cores: your licensing goes up, so you’re better off splitting workspaces into more SQL Servers, each with their own RAM SOS_SCHEDULER_YIELD: throwing hardware at it
  • 62. © kCura LLC. All rights reserved. • When you delete/update/insert records, SQL Server: – Writes to the transaction log before your transaction is committed – Writes the data file contents later, asynchronously – This means data file write speeds matter less than you might expect, but log file speed is super-important to loading documents • Performance Monitor counter: Physical Disk: Avg Sec/Write (aka write latency) – Reported in whole seconds – use 3 decimal places for MS. – Microsoft says >3 milliseconds log writes are slow. Me: 20. • Related counters: Physical Disk: Reads/sec, Writes/sec show how much SQL is asking for • The more we ask storage to work, the slower it’ll get. WRITELOG: writing to the transaction log file during DUIs
  • 63. © kCura LLC. All rights reserved. Recap
  • 64. © kCura LLC. All rights reserved. Know your top wait type. • Performance tuners know these 3 metrics: 1. Total database size (and quantity) 2. Batch Requests/Second 3. Wait Time per Core per Hour (or per sec) • Capture the metrics with sp_BlitzFirst. • Your top wait stat is where to focus your tuning.
  • 65. © kCura LLC. All rights reserved. sp_BlitzFirst @SinceStartup = 1 If the top wait is… Then SQL Server is waiting on… Tuning options CXPACKET Parallelism Set Cost Threshold and Maxdop, identify expensive queries, tune indexes PAGEIOLATCH Reading data pages from disk Add memory, tune indexes, tune storage SOS_SCHEDULER_ YIELD CPU cycles Tune indexes, add CPU power WRITELOG Writing to the transaction log Tune storage, move logs onto SSD
  • 66. Let Us Know What You Think You’ll receive a short survey via email for each breakout session and the overall event. Please take a minute to tell us what you think.

Editor's Notes

  1. You host Relativity data in SQL Server, and you can't just go buy a new server. You need to figure out where your server's bottleneck is, and find the easiest workaround to make it go faster. Microsoft Certified MasterBrent Ozar will show you how to check your SQL Server's vital stats with free tools, and then determine whether you need indexes, memory, or different config settings.
  2. Assume we have the world’s smallest SQL Server – it’s only got one core.
  3. Assume we have the world’s smallest SQL Server – it’s only got one core.
  4. Assume we have the world’s smallest SQL Server – it’s only got one core.
  5. Assume we have the world’s smallest SQL Server – it’s only got one core.
  6. Assume we have the world’s smallest SQL Server – it’s only got one core.
  7. Today, we’re only focusing on that top list, Resources, because those are the most common problems for end user queries.