Académique Documents
Professionnel Documents
Culture Documents
InvestigatingI/Obottleneckstutorialandexample
>>Tut orialMenu
InvestigatingI/Obottlenecks
(PerformanceIssues)
enteremailaddress
+2
Join
Overview
SQLServerisusuallyahighI/Oactivityprocessandinmostcasesthedatabaseislargerthantheamountofmemory
installedonacomputerandthereforeSQLServerhastopulldatafromdisktosatisfyqueries.Inaddition,sincethe
dataindatabasesisconstantlychangingthesechangesneedtobewrittentodisk.Anotherprocessthatcanconsumea
lotofI/OistheTempDBdatabase.TheTempDBdatabaseisatemporaryworkingareaforSQLServertodosuch
thingsassortingandgrouping.TheTempDBdatabasealsoresidesondiskandthereforedependingonhowmany
temporaryobjectsarecreatedthisdatabasecouldbebusierthanyouruserdatabases.
SinceI/OissuchanimportantpartofSQLServerperformanceyouneedtomakesureyourdisksubsystemisnotthe
bottleneck.Intheolddaysthiswasmucheasiertodo,sincemostservershadlocalattachedstorage.Thesedays
mostSQLServersuseSANorNASstorageortofurthercomplicatethingsmoreandmoreSQLServersarerunningina
virtualizedenvironment.
Explanation
ThereareseveraldifferentmethodsthatcanbeusedtotrackI/Operformance,butasmentionedabovewithSAN/
NASstorageandvirtualizedSQLServerenvironments,thisisgettingharderandhardertotrackaswellastherules
havechangedasfaraswhatshouldbetrackedtodetermineifthereisanI/Obottleneck.Theadvantageisthatthere
areseveraltoolsavailableatboththestoragelevelandthevirtualleveltoaidinperformance,butwewillnotcover
thesehere.
TherearebasicallytwooptionsthatyouhavetomonitorI/Obottlenecks,SQLServerDMVsandPerformanceMonitor
counters.Thereareothertoolsaswell,butthesearetwooptionsthatwillexistineverySQLServerenvironment.
DMVsys.dm_io_virtual_file_stats
ThisDMVwillgiveyoucumulativefilestatsforeachdatabaseandeachdatabasefileincludingboththedataandlog
files.Basedonthisdatayoucandeterminewhichfileisthebusiestfromareadand/orwriteperspective.
TheoutputalsoincludesI/Ostallinformationforreads,writesandtotal.TheI/Ostallisthetotaltime,inmilliseconds,
thatuserswaitedforI/Otobecompletedonthefile.BylookingattheI/Ostallinformationyoucanseehowmuch
timewaswaitingforI/Otocompleteandthereforetheuserswerewaiting.
ThedatathatisreturnedfromthisDMViscumulativedata,whichmeansthateachtimeyourestartSQLServerthe
countersarereset.Sincethedataiscumulativeyoucanrunthisonceandthenrunthequeryagaininthefutureand
comparethedeltasforthetwotimeperiods.IftheI/Ostallsarehighcomparedtothelengthofthethattimeperiod
thenyoumayhaveanI/Obottleneck.
SELECT
cast(DB_Name(a.database_id)asvarchar)asDatabase_name,
b.physical_name,*
FROM
sys.dm_io_virtual_file_stats(null,null)a
INNERJOINsys.master_filesbONa.database_id=b.database_idanda.file_id=b.file_id
ORDERBYDatabase_Name
Hereispartialoutputfromtheabovecommand.
https://www.mssqltips.com/sqlservertutorial/254/investigatingiobottlenecks/
1/3
12/14/2015
InvestigatingI/Obottleneckstutorialandexample
PerformanceMonitor
PerformanceMonitorisaWindowstoolthatlet'syoucapturestatisticsaboutSQLServer,memoryusage,I/Ousage,
etc...ThistoolcanberuninteractivelyusingtheGUIoryoucansetituptocollectedinformationbehindthescenes
whichcanbereviewedatalatertime.ThistoolisfoundintheControlPanelunderAdministrativetools.
ThereareseveralcountersrelatedtoI/OandtheyarelocatedunderPhysicalDiskandLogicalDisk.ThePhysicalDisk
performanceobjectconsistsofcountersthatmonitorhardorfixeddiskdriveonacomputer.TheLogicalDisk
performanceobjectconsistsofcountersthatmonitorlogicalpartitionsofahardorfixeddiskdrives.Forthemostpart,
theybothcontainthesamecounters.InmostcasesyouwillprobablyusethePhysicalDiskcounters.Hereisapartial
listoftheavailablecounters.
Nowthatstoragecouldbeeitherlocal,SAN,NAS,etc...thesetwocountersarehelpfultoseeifthereisabottleneck:
Avg.Disksec/Readistheaveragetime,inseconds,ofareadofdatafromthedisk.
Avg.Disksec/Writeistheaveragetime,inseconds,ofawriteofdatatothedisk.
Therecommendationisthatthevaluesforbothofthesecountersbelessthan20ms.Whenyoucapturethisdatathe
valueswillbedisplayedas0.000,soavalueof0.050equals50ms.
ResourceMonitor
AnothertoolthatyoucanuseistheResourceMonitor.ThiscanbelaunchedfromTaskManagerorfromtheControl
Panel.
BelowyoucanseetheDisktabthatshowscurrentprocessesusingdisk,theactivediskfilesandstorageatthelogical
andphysicallevel.TheResponseTime(ms)ishelpfultoseehowlongitistakingtoservicetheI/Orequest.
AdditionalInformation
I/Oissuesmaynotalwaysbeaproblemwithyourdisksubsystem.JustbecauseyouseeaslowdownorI/Owaits
occurringtheremaybeotherissuesthatyouneedtoconsidersuchasmissingindexes,poorlywrittenqueries,
fragmentationoroutofdatestatistics.Wewillcoverthesetopicsaswellinthistutorial.
HerearesomeadditionalarticlesaboutI/Operformance.
CreatingIOperformancesnapshotstofindSQLServerperformanceproblems
BenchmarkingSQLServerIOwithSQLIO
HowtoIdentifyIOBottlenecksinMSSQLServer
https://www.mssqltips.com/sqlservertutorial/254/investigatingiobottlenecks/
2/3
12/14/2015
InvestigatingI/Obottleneckstutorialandexample
MoreSQLServerSolutions
24/7SQLServerMonitoringTools|SQLDiagnosticManager|TryforFree
FreeSQLServertoolBethefirsttoknowwhendatabaseschangewithRedgatesDLMDashboard
SolvingSQLServerproblemsformillionsofDBAsandDevssince2006.Joinnow.
FreeSQLServerTutorialsStoredProcedures,PerformanceMonitoring,QueryPlans,SSISandmore
FreeLearningClickheretobecomeabetterSQLServerProfessional
Follow
Learning
Resources
Search
Community
MoreInfo
GetFreeSQLTips
DBAs
Tutorials
TipCategories
FirstTimer?
Join
Developers
Webcasts
SearchByTipID
Pictures
About
BIProfessionals
Whitepapers
Authors
FreeTshirt
Copyright
Google+
Careers
Tools
Contribute
Privacy
QandA
Events
Disclaimer
Today'sTip
UserGroups
Feedback
AuthoroftheYear
Advertise
RSS
Copyright(c)20062015EdgewoodSolutions,LLCAllrightsreserved
Somenamesandproductslistedaretheregisteredtrademarksoftheirrespectiveowners.
https://www.mssqltips.com/sqlservertutorial/254/investigatingiobottlenecks/
3/3