performance tuning sql server on crappy hardware...consultant denny cherry & associates...
TRANSCRIPT
![Page 1: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/1.jpg)
3/1/2019 1
PERFORMANCE TUNING
SQL SERVER ON
CRAPPY HARDWARE
![Page 2: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/2.jpg)
PLEASE FILL OUT AND
PASS TO YOUR
HELPER BEFORE YOU LEAVE THE
SESSION
FEEDBACK FORMS
![Page 3: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/3.jpg)
Consultant
Denny Cherry & Associates Consulting
PASS Mid-Atlantic Regional Mentor
User Group Leader: Hampton Roads VA
@SQLEspresso
sqlespresso.com
linkedin.com/in/sqlespresso
MONICA RATHBUN
![Page 4: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/4.jpg)
PRESENTATION RULES
Always Ask Questions
Interrupt Me
This is a two-way conversation, let’s
learn from each other’s
experiences
![Page 5: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/5.jpg)
AGENDA
The Basics
Identify Bottlenecks
Yep, You Have
Problems
Reducing IO
Snapshot Isolation
Execution Plans
![Page 6: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/6.jpg)
3/1/2019 6
BEST PRACTICESStart with the basics.
Tempdb
Memory
Patching
Services
Power Plan
Friends
![Page 7: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/7.jpg)
POWER PLAN Windows Control Panel Power Options
![Page 8: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/8.jpg)
SERVICESWhy are you running this?
![Page 9: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/9.jpg)
PATCHING
Bug Fixes Performance Degradations
ImprovementSQL 2016 SP1
Optimizer
Support Microsoft Support
Drivers on VM and NICs
Windows Patches
Build Listhttps://sqlserverbuilds.blogspot.com/
![Page 10: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/10.jpg)
MEMORY Proper configuration is vital
• Min and Max Memory• Multiple Instances• Extra Services SSRS, SSIS,
SSAS• Lock Pages in Memory *• Set Memory Reservation for
Your VM on Host• Don’t over allocate!
![Page 11: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/11.jpg)
TEMPDB
Pin to High Performing Disk
Multiple Files
1 file per CPU core up to 8 files
Traceflag1118/1117
Pre 2016
Heavy Contention 2016-2017 fixed in
CU 8 and CU 5
Trace Flag 2453 to allow table
variables to trigger recompile
Everything Uses TEMPDB Make sure you don’t ignore it.
![Page 12: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/12.jpg)
Their baby might be ugly
MAKE FRIENDS WITH
NETWORK & STORAGE
ADMINS
![Page 13: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/13.jpg)
IDENTIFYING BOTTLENECKSPerfmon Counters
Latency\Queue
• Avg. Disk sec/Read counter
• Avg. Disk sec/Write counter
• Avg. Disk Queue Length
1
Memory
• Database Pages
• Page Life Expectancy
• Available MBYTES
2
CPU
• Processor\% Processor Time
• Processor\% User Time
• Processor\% Interrupt Time
3
Third Party Tools
• SentryOne
• Idera
• SolarWinds
• Red Gate
4
![Page 14: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/14.jpg)
YEP YOU HAVE
PROBLEMS Bad\Old Hardware
Older Disks Just Not Fast Enough
Limited Physical Server
No Memory Slots
Slow CPU
Budget No New Hardware
No New Licenses
Team Just Doesn’t
Get SQL
RAID 5 for ALL
Clones
Challenges Ahead
![Page 15: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/15.jpg)
VIRTUAL ENVIRONMENTS Over Provisioned Hosts
Thin Provisioning
What Happens on One VM Now Effects Another
Too Many VMs on One Host
VM Over/Under CPU Allocation
Thin Provisioning
![Page 16: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/16.jpg)
REDUCE DISK IO READS & WRITES
Compression Indexing
Data LoadsStatistics
Now Available in
Standard Edition
![Page 17: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/17.jpg)
3/1/2019 17
COMPRESSIONMore data in memory – It’s the GOLDEN EGG!
Row/Page Compression -
More Data In MEMORY
Backup Compression: Less
Data in STORAGE
![Page 18: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/18.jpg)
3/1/2019 18
Wasted Write Disk IO
Disable then Delete
Wasted Read IOAvoid Duplicates
Consolidate Indexes
Specific Query Tuning – Key Lookups
INDEXES
Remove Un-Used Indexes
Find Missing Indexes
Covering Indexes
These are not set it and forget it.
![Page 19: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/19.jpg)
3/1/2019 19
Maintain Keep These Up To Date!
Updates Sync vs Async
Trace Flags Trace Flag 2371
Missing Stats Did You Know You Can Make Your Own?
STATISTICSThis is the magic sauce that helps the optimizer.
Defaulted in SQL 2016
![Page 20: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/20.jpg)
DATA LOADSKnow Your Environment
Avoid Truncate and Reload
Replication
Change Data Capture
SSIS
![Page 21: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/21.jpg)
Snapshot Isolation
Is updated row versions for each transaction are maintained in tempdb.
ALLOW SNAPSHOT ISOLATION &
READ COMMITED SNAPSHOT ISOLATION (RSCI)
RCSI option
Allows access to versioned rows under the default READ COMMITTED isolation level.
If set to OFF, you must explicitly set the level for each session in order to access versioned rows
READERS CANT BLOCK WRITERS AND
WRITERS CANT BLOCK READERS
![Page 22: PERFORMANCE TUNING SQL SERVER ON CRAPPY HARDWARE...Consultant Denny Cherry & Associates Consulting PASS Mid-Atlantic Regional Mentor User Group Leader: Hampton Roads VA MRathbun@sqlespresso.com](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec85429a0441d6d4b5dfde0/html5/thumbnails/22.jpg)
EXECUTION PLANSEasy things to look at
Index Needs
More Granular Review
Missing Includes
Scans
Sorts Does the data need to be sorted?
Can it be done elsewhere?
Key Lookups
Extra Reads
Easily Avoided in Most Cases
Spills Spills to TempDB
Forced to go to Disk