sar 命令的详解,E文的~~Windows系统 -电脑资料
sar--systemactivityreporter sar(ADM)providesinformationthatcanhelpyouunderstandhowsystemresourcesarebeingusedonyoursystem.Thisinformationcanhelpyousolveandavoidseriousperformanceproblemsonyoursystem. Theinpidualsaroptionsaredescribedonth
sar--systemactivityreporter
sar(ADM)providesinformationthatcanhelpyouunderstandhowsystemresourcesarebeingusedonyoursystem.Thisinformationcanhelpyousolveandavoidseriousperformanceproblemsonyoursystem.
Theinpidualsaroptionsaredescribedonthesar(ADM)manualpage.
ForsystemswithanSCOSMPLicense,mpsar(ADM)reportssystemwidestatistics,andcpusar(ADM)reportsper-CPUstatistics.
Thefollowingtablesummarizesthefunctionalityofeachsar,mpsar,andcpusaroptionthatreportsanaspectofsystemactivity:
sar,cpusar,andmpsaroptions
OptionActivityreported
-afileaclearcase/" target="_blank" >ccessoperations
-Asummarizeallreports
-bbuffercache
-Bcopybuffers
-csystemcalls
-dblockdevicesincludingdisksandallSCSIperipherals
-Ffloatingpointactivity(mpsaronly)
-gserialI/Oincludingoverflowsandcharacterblockusage
-hscatter-gatherandphysicaltransferbuffers
-Iinter-CPUinterrupts(cpusarandmpsaronly)
-jinterruptsservicedperCPU(cpusaronly)
-Llatches
-mSystemVmessagequeueandsemaphores
-nnameicache
-OasynchronousI/O(AIO)
-ppaging
-qrunandswapqueues
-QprocesseslockedtoCPUs(cpusarandmpsaronly)
-runusedmemoryandswap
-Rprocessscheduling
-SSCSIrequestblocks
-uCPUutilization(defaultoptionforallsarcommands)
-vkerneltables
-wpagingandcontextswitching
-yterminaldriverincludinghardwareinterrupts
http://docsrv.caldera.com:8507/usr/share/doc/OpenServer/en/PERFORM/tool_sar.html
answer 回复于:2003-06-11 13:05:28HowdoIquicklydeterminethecauseofaperformanceproblem?
--------------------------------------------------------------------------------
Keywords
openserver5.0.05.0.25.0.45.0.55.0.65.0performanceproblemtroubleshootbottlenecksarslowsystemguideactivitymemoryCPUtimewiousrbottleneckuw7unixwareunixware7uwouou8openunixopenunix87117.1.1caldera7137.1.3analysisanalyse
Release
SCOOpenServerEnterpriseSystemRelease5.0.5,5.0.6,5.0.7
SCOOpenServerDesktopSystemRelease5.0.5,5.0.6,5.0.7
SCOOpenServerEnterpriseSystemRelease5.0.2,5.0.4
SCOOpenServerDesktopSystemRelease5.0.2,5.0.4
UnixWare7Release7.1.1,7.1.3
CalderaOpenUNIXRelease8.0.0
Problem
Mysystemisbehaviorisslow.HowdoIquicklydeterminethemostlikelycauseofthebottleneck?
Solution
Thefollowingisatwo-stepguidetoquicklyfindingthebottleneckonasystemwithslowperformance.
Note
Runningtwosarcommandsasa"beforeandafter"test,(oncebeforethesystemslowdownandonceduringthesystemslowdown),willmakeiteasiertoseedifferencesinsardata.
Charactersafterthe'#'signindicatecommandstoberun.
STEP1
------
Checkthegeneralsystemactivity:
#sar15
09:35:13%usr%sys%wio%idle(-u)
09:35:14170083
09:35:1550095
09:35:1650095
09:35:1750095
09:35:1851094
Average70092
Thiscommandshouldalwaysberunfirsttogetageneralideaoftheprimary
locationofthebottleneck.
If%usrishigh,thenthesystemiswaitingforusercommandstofinish
(i.e.sort,datagathering/processingprograms).
CAUSES:Non-interactiveprogramsrunningunnecessarilyatpeakhours,
slowCPU,notenoughCPUs,unnecessaryprogramsrunning,inefficient
thirdpartyprogamsrunning,daemonsprocessingdata,badnicevalues.
If%sysishigh,thenthesystemiswaitingforkerneldrivercallsto
complete(i.e.hardwareissues,spuriousinterrupts,thirdpartydrivers).
CAUSES:Inefficientthirdpartydrivers,badhardwarecausingspurious
interrupts,slowCPU,notenoughCPUs.
IfBOTH%usrand%sysarehigh,thenthesystemiswaitingforalltypes
ofsystemcalls,whethertheyareusergeneratedorkernelgenerated.
CAUSES:SlowCPU,notenoughCPUs.
If%wioishigh,thesystemiswaitingforthedisksubsystemtoretrievedata.
CAUSES:Notenoughdiskcache(NBUF/NHBUF),slowharddrivesystem,not
enoughmemory,memoryleakfromprocess,processgrabbingtoomuchmemory.
STEP2
------
IF%usrISHIGH:
1)CheckforprocessesconsumingtoomuchCPUtime:
#ps-el|more
FSUIDPIDPPIDCPRINIADDRSZTTYTIMECMD
71
S00009520fb1170000?00:00:01sched20S01006620fb117158148?00:00:00init
.
.
.
20S0347107624fb119db0312?00:00:00snmpd
20S17349116620fb119f08156?01:05:53deliver
20S041341007520fb11a060128?00:00:00lockd
(WCHANremovedtofitinscreen)
ChecktheCandTIMEvalues.IftheTIMEvalue(minutes:seconds:100thsof
asecond)isunusuallyhighandCispositiveforaspecificprocess,then
thatprocesscouldbetaxingthesystem.Intheaboveexample,thedeliver
daemonisprocessingleftoveradminmail.Themailcanberemoved.
2)Checkforsystemcallactivity:
#sar-c15
SCO_SVtuvok3.2v5.0.5i8038606/21/2001
09:55:08scall/ssread/sswrit/sfork/sexec/srchar/swchar/s(-c)
09:55:09121667120.990.991784413988
09:55:101473160.000.001687238421
09:55:11742740.000.001636443342
09:55:122453760.000.001718218928
09:55:131512940.000.001637703468
Average3673860.200.201692805629
Checkbeforeandafterforsystemcalls,forks,execs.,etc.Ifsystem
callsarehigh,itindicatesoneormoreofthefollowing:
-Programsaresuddenlybeingusedmoreactively.
-Moreprogramsingeneralarebeingrunonthesystem.
Usepstochecktoseeifthisisnecessary.Ifforks/execs,orreads/writes
arespecificallyhigh,checkforprogramsthatmaybecallingspecificcalls.
IF%sysISHIGH:
Ifyouhaveamuliprocessingsystem,runthefollowingcommandtoseeif
anydeviceissendingthousandsofinterruptstoslowdowntheCPU.
ForOpenServer5:
#sar-j15
ForUnixWare7/OpenUNIX8:
#sar-PALL15
Checkprogramsthatcouldbeaccessingthetapedrive,thirdpartysmart
boards,orothernon-diskdrivers.
IFBOTHUSRANDSYSAREHIGH:
1)Checktherunqueue:
#sar-q15
SCO_SVlunasco3.2v5.0.4Pentium06/21/2001
10:46:29runq-sz%runoccswpq-sz%swpocc(-q)
10:46:303.0100
10:46:31
10:46:321.0100
10:46:331.0100
10:46:341.0100
Average1.5100
NormallytheAveragetimeshouldbelessthan3onataxedsystem.Ifthe
averagetimeisconstantlyhigherthanthat,theprocessesarenotbeing
servicedquickenough;theCPUcouldbetoblame.EitherincreasetheCPU
speedoraddCPUs,ifpossible.
IF%wioISHIGH:
1)Checkforgreedyprocesses:
#ps-el|more
FSUIDPIDPPIDCPRINIADDRSZTTYTIMECMD
71S00009520fb1170000?00:00:01sched
20S01006620fb117158148?00:00:00init
71S02009520fb1172b00?00:00:00vhand
71S03009520fb1174080?00:00:16bdflush
71S04009520fb1175600?00:00:00kmdaemon
71S05109520fb1176b80?00:00:18htepi_daemon
.
.
.
20S0252107620fb118830152?00:00:00cron
20S0354107624fb118988233504?00:00:03report
20S0496107624fb118ae0200?00:00:00calserver
ChecktheSZvaluetoseeifaprocessiseithergrabbingtoomuchmemoryor
notfreeingitupwhenneeded.Intheaboveexample,the"report"programis
grabbingalotofmemory.
2)Checktheamountofuseablememory:
#sar-r15
SCO_SVtuvok3.2v5.0.5i8038606/21/2001
10:34:13freememfreeswpavailrmemavailsmem(-r)
10:34:1482623891202876556421
10:34:1582623891202876556421
10:34:1682623891202876556421
10:34:1782623891202876556421
10:34:1882623891202876556421
Average82623891202876556421
Iffreemem(listedin4Kpages)isbelow500andfreeswapisdynamic,the
systemispagingindatabecauseitcan'tfitwhatitneedsinmemory.
Ifthisishappeningallthetime,increaseRAM.
Note
InOpenServersar-rreportstheamountofswapspaceondisk.InUnixWare7/OpenUNIX8,itreportstheswapspaceinvirtualmemory(RAMplusswap).
3)Checkthediski/ousage:
#sar-b15
SCO_SVtuvok3.2v5.0.5i8038606/21/2001
10:37:17bread/slread/s%rcachebwrit/slwrit/s%wcachepread/spwrit/s(-b)
10:37:1800000000
10:37:1900000000
10:37:200601000110000
10:37:210-110000000
10:37:220561000110000
Average0241000010000
If%rcacheiscontinuously<95and/or%wcacheis<90,thenthesystemis
havingtogototheharddrivetoloadthediskcache.Increasethedisk
cachebyincreasingNBUFby50percentandadjustingNHBUFappropriately.
ForUnixWare7/OpenUNIX8.0.0,therearetheadditionalkerneltunables:
"FDFLUSHR",thisistheintervalinsecondstochecktheneedtowritethe
buffercacheandfilepagestodisk.Thedefaultis1.
"NAUTOUP",thisisthehumberofsecondsbetweenfilesystemsupdates.The
defaultis60seconds.IncreasingNAUTOUPcanimproveperformance,butalso
increasetheriskofdatalossshouldasystemcrashoccur.
Also,check"sar-d".A%busyfigureaveraging>50%canindicateadisk
bottleneck.The"avserv"columnshowsservicetumeafterarequesthasarrived
atthedisk.The"await"columnshowstheaveragewaittimeforanI/Orequest
tobeserviced.The"avque"columnshowstheaveragelengthofthewaitqueue
foranI/Orequest.
Ifthediskperformanceappearstobeacceptable,butyouhaveunacceptable
levelsofCPUtimedevotedtowaitingforI/O,thenyoumayhaveamemory
bottleneck.
Note
MakesureyoudonotincreaseNBUFbysomuchthatyourunoutofregulargeneralpurposememory(checkwithsar-r).
Ifneithermemorynorthediskcacheisaproblem,checkthediski/o
systemasyoumayneedaRAIDsystemorafasterhostadaptersystem.
Note
Ingeneral,ensurethattheserverhasthelatestpatches,hostbusadaptorsand .networkdriversareinstalledavailablefrom:
ftp://ftp.sco.com/pub
http://www.sco.com/download
Note
Thereareothertoolsavailabletoassistinidentifyingtheprocessesandanalysingtheoutputofsar.
Theseare:
rtpm(1M)forUnixWare7/OpenUNIX8.0.0
"top"availablefromSkunkwareathttp://www.sco.com/skunkware
"hog"packageavailablefromSkunkware,above.
SarCheckavailablefromhttp:/www.sarcheck.com
SeeAlso
sar(ADM),vmstat(C),idtune(ADM)
TA#117424,HowcanIanalyze"on-the-spot"performancedatawith
SarCheck?"
TA#114622,"HowdoIinstallandrunSarCheck?"
http://www.aplawrence.com/Unixart/slow.html
--------------------------------------------------------------------------------
http://stage.caldera.com/ns-search/TAEXT/os/116222.shtml?NS-search-set=/3ee66/aaaa002GWe66d1a&NS-doc-offset=0&
swwin 回复于:2003-06-11 13:57:16answer,能否给翻译成中文?
原文转自:http://www.ltesting.net