Вы находитесь на странице: 1из 25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

IBMBluemixBuildanddeployonahybridcloud.
Startyourfreetrial

developerWorks

Technicaltopics

WebSphere

Technicallibrary

Casestudy:TuningWebSphereApplicationServer
V7andV8forperformance
UpdatedforWebSphereApplicationServerV8
IBMWebSphereApplicationServersupportsanevergrowingrangeofapplications,eachwiththeirownuniqueset
offeatures,requirements,andservices.Justasnotwoapplicationswilluseanapplicationserverinexactlythesame
way,nosinglesetoftuningparameterswilllikelyprovidethebestperformanceforanytwodifferentapplications.Most
applicationswillgenerallyrealizesomeperformanceimprovementfromtuninginthreecoreareas:theJVM,thread
pools,andconnectionpools.ThisarticleusestheApacheDayTraderPeformanceBenchmarkSampleapplicationto
demonstratewhatyoucantuneandhowtogoabouttuningit,dependingonthemajorservercomponentsand
resourcesthatyourapplicationuses.UpdatedforWebSphereApplicationServerV8.ThiscontentispartoftheIBM
WebSphereDeveloperTechnicalJournal.
Share:
DavidHareanAdvisorySoftwareEngineerwiththeWebSphereApplicationServerPerformanceandBenchmarkingorganizationin
ResearchTrianglePark,NorthCarolina.HisprimaryfocushasbeenontheDayTraderperformancebenchmark,performancetuning,andthe
brandnewLibertyProfile.

ChristopherBlythewasanAdvisorySoftwareEngineerandtechnicalteamleadintheWebSphereApplicationServerPerformanceand
Benchmarkingorganizationatthetimeoforiginalpublication.

22June2011(Firstpublished30September2009)
AlsoavailableinChineseJapanesePortuguese

Introduction
IBMWebSphereApplicationServerisarobust,enterpriseclassapplication
serverthatprovidesacoresetofcomponents,resources,andservicesthat
developerscanutilizeintheirapplications.Everyapplicationhasaunique
setofrequirementsandoftenusesanapplicationserversresourcesin
vastlydifferentways.Inordertoprovideahighdegreeofflexibilityand
supportforthiswidevarietyofapplications,WebSphereApplicationServer
offersanextensivelistoftuning"knobs"andparametersthatyoucanuseto
enhanceanapplicationsperformance.

Developanddeployyour
next
appontheIBMBluemix
cloudplatform.

Startyourfreetrial

Defaultvaluesforthemostcommonlyusedtuningparametersintheapplicationserveraresettoensure
adequateperformanceoutoftheboxforthebroadestrangeofapplications.However,becausenotwo
applicationsarealikeorusetheapplicationserverinexactlythesamefashion,thereisnoguaranteethat
anysinglesetoftuningparameterswillbeperfectlysuitedforeveryapplication.Thisrealityhighlights
howimportantitisforyoutoconductfocusedperformancetestingandtuningagainstyourapplications.
ThisarticlediscussesseveralofthemostcommonlyusedparametersinWebSphereApplicationServer
V7andV8(andpreviousreleases)andthemethodologiesusedtotunethem.Unlikemanydocumented
tuningrecommendations,thisarticleusestheApacheDayTraderPerformanceBenchmarkSample
applicationasacasestudytoprovidecontexttothediscussion.WiththeDayTraderapplication,youwill
beabletoclearlyidentifythekeyservercomponentsinuse,performfocusedtuningintheseareas,and
witnessthebenefitassociatedwitheachtuningchange.
http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

1/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

TheinformationinthisarticleappliestobothWebSphereApplicationServerVersions7and8,
exceptwherenoted.
Beforeproceeding,hereareafewadditionalthingstokeepinmindwhentuningyourapplicationserver
forperformance:
Increasedperformancecanofteninvolvesacrificingacertainleveloffeatureorfunctioninthe
applicationortheapplicationserver.Thetradeoffbetweenperformanceandfeaturemustbeweighed
carefullywhenevaluatingperformancetuningchanges.
Severalfactorsbeyondtheapplicationservercanimpactperformance,includinghardwareandOS
configuration,otherprocessesrunningonthesystem,performanceofbackenddatabaseresources,
networklatency,andsoon.Youmustfactorintheseitemswhenconductingyourownperformance
evaluations.
TheperformanceimprovementsdetailedherearespecifictotheDayTraderapplication,workloadmix,
andthesupportinghardwareandsoftwarestackdescribedhere.Anyperformancegainstoyour
applicationthatresultfromthetuningchangesdetailedinthisarticlewillcertainlyvary,andshouldbe
evaluatedwithyourownperformancetests.

TheDayTraderapplication
TheApacheDayTraderPerformanceBenchmarkSample
Fromideatoproductionin
minutes?
applicationsimulatesasimplestocktradingapplicationthatlets
Don'tletlimitedintegrationslowyou
userslogin/logout,viewtheirportfolio,lookupstockquotes,buy
down.Consistentlydeliverhighquality
andsellstockshare,andmanageaccountinformation.DayTrader
softwarefasterusingDevOpsservicesfor
notonlyservesasanexcellentapplicationforfunctionaltesting,but IBMBluemixanendtoendsolution
withtheservicesyouneedtodeliveryour
italsoprovidesastandardsetofworkloadsforcharacterizingand
innovativeideasquickly.
measuringapplicationserverandcomponentlevelperformance.
Signupforafreetrial
DayTrader(andtheTradePerformanceBenchmarkSample
applicationbyIBMonwhichDayTraderwasoriginallybased)was
notwrittentoprovideoptimalperformance.Rather,theapplicationsisintendedtoconductrelative
performancecomparisonsbetweenapplicationserverreleasesandalternativeimplementationstylesand
patterns.
DayTraderisbuiltonacoresetofJavaEnterpriseEdition(JavaEE)technologiesthatincludeJava
servletsandJavaServerPages(JSPs)forthepresentationlayer,andJavadatabaseconnectivity
(JDBC),JavaMessageService(JMS),EnterpriseJavaBeans(EJBs)andmessagedrivenbeans
(MDBs)forthebackendbusinesslogicandpersistencelayer.Figure1showsahighleveloverviewof
theapplicationarchitecture.
Figure1.DayTraderapplicationoverview

http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

2/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

InorderforyoutoevaluateafewcommonJavaEEpersistenceandtransactionmanagementpatterns,
DayTraderprovidesthreedifferentimplementationsofthebusinessservices.Theseimplementations(or
runtimemodes)areshowninTable1.
Table1.DayTraderimplementations
Run
time
mode
Direct

Pattern

Description

ServlettoJDBC

Create,read,update,anddelete(CRUD)operationsareperformeddirectlyagainstthe
databaseusingcustomJDBCcode.Databaseconnections,commits,androllbacksare
managedmanuallyinthecode.
Session ServlettoStateless CRUDoperationsareperformeddirectlyagainstthedatabaseusingcustomJDBCcode.
Direct SessionBeantoJDBC Databaseconnectionsaremanagedmanuallyinthecode.Databasecommitsandrollbacks
aremanagedautomaticallybythestatelesssessionbean.
EJB
Servletto
TheEJBcontainerassumesresponsibilityforallqueries,transactions,anddatabase
StatelessSessionBeanconnections.
toEntityBean

Theseruntimemodesareincludedwithinthescopeofthisarticletodemonstratetheimpacteachtuning
changehasonthesethreecommonJavaEEpersistenceandtransactionimplementationstyles.

NavigatingtheWebSphereApplicationServertunables
Asmentionedearlier,theimportanceofunderstandingtheapplicationarchitecture,theserver
components,andtheresourcesutilizedbytheapplicationcannotbestressedenoughwhenconducting
performancetuning.Withthisknowledge,youcanquicklyfilterthelistoftunableparametersandfocus
onacoresetoftunablesthatdirectlyimpactyourapplication.
PerformancetuninggenerallystartswiththeJavaVirtualMachine(JVM),whichservesasthefoundation
fortheapplicationserver.Fromthatpointforward,tuningisprimarilydrivenbytheapplicationserver
componentsthatareusedbytheapplication.Forexample,youcanidentifysomeofthekeytunable
servercomponentsoftheDayTraderapplicationusingthearchitecturediagram(Figure1):
WebandEJBcontainers
Associatedthreadpools
Databaseconnectionpools
Defaultmessagingprovider.
Theremainderofthisarticlediscussesdetailsofseveraltuningoptionsthatimpacttheperformanceof
DayTraderbasedonthecomponentslistedabove.Theseoptionshavebeendividedintothesesections:
Basictuning:Thisgroupoftuningparameterscoversafewofthemostcommonlytunedandheavily
http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

3/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

usedapplicationservercomponents,startingwiththeJVM.Thesesettingstraditionallyprovidethemost
bangforthebuck.
Advancedtuning:Thissecondarygroupofadvancedtuningparametersaregenerallyspecifictoa
certainscenarioandareoftenusedtosqueaktheabsolutemostperformanceoutofasystem.
Asynchronousmessagingtuning:Theoptionsdiscussedherearespecifictoapplicationsthatutilize
WebSphereApplicationServersmessagingcomponentsforasynchronousmessaging.
Thetuningparametersgroupedinthesesectionsarepresentedwithadetaileddiscussionofapplicability,
andinformationrelatedtofunctionaltradeoffsandtheirultimateimpactonperformance(foreachofthe
persistenceandtransactionmanagementpatterns,ifappropriate).Toolsthatcanaidinthetuning
processforagivenparameterarealsopresented.LinkstoassociatedWebSphereApplicationServer
InformationCenterdocumentationorotherrelatedresourcesareprovidedineachsection,andalso
summarizedintheResourcessection.

Basictuning
Discussedinthissection:
a. JVMheapsize
b. Threadpoolsize
c. Connectionpoolsize
d. Datasourcestatementcachesize
e. ORBpassbyreference

a.JVMheapsize
JVMheapsizeparametersdirectlyinfluencegarbagecollectionbehavior.IncreasingtheJVMheapsize
permitsmoreobjectstobecreatedbeforeanallocationfailureoccursandtriggersagarbagecollection.
Thisnaturallyenablestheapplicationtorunforalongerperiodoftimebetweengarbagecollection(GC)
cycles.Unfortunately,anassociateddownsidetoincreasedheapsizeisacorrespondingincreaseinthe
amountoftimeneededtofindandprocessobjectsthatshouldbegarbagecollected.Consequently,JVM
heapsizetuningofteninvolvesabalancebetweentheintervalbetweengarbagecollectionsandthe
pausetimeneededtoperformthegarbagecollection.
InordertotunetheJVMheapsize,verboseGCneedstobeenabled.Thiscanbedoneinthe
WebSphereApplicationServeradministrativeconsolebynavigatingtoServers=>Applicationservers
=>server_name=>Processdefinition=>JavaVirtualMachine.ByenablingverboseGC,theJVM
printsoutusefulinformationateachgarbagecollection,suchastheamountoffreeandusedbytesinthe
heap,theintervalbetweengarbagecollections,andthepausetime.Thisinformationisloggedtothe
native_stderr.logfile,whichcanthenbeusedbyvarioustoolstovisualizetheheapusage.
WebSphereApplicationServer'sdefaultheapsettingsare50MBfortheinitialheapsizeand256MBfor
themaximumheapsize.Itisgenerallyrecommendedtosettheminimumandmaximumheapsizesto
thesamevalueformaximumperformance.Seebelowtounderstandwhy.
Testing
FourlabtestswereconductedwithverboseGCenabled,withtheinitialandmaximumheapsizesboth
setto256MB,512MB,1024MB,and2048MB,respectively.YoucananalyzeverboseGCmanually,
butgraphicaltoolsliketheIBMMonitoringandDiagnosticToolsforJavaGarbageCollectionand
MemoryVisualizertool(packagedwiththeIBMSupportAssistant,whichisfreelyavailablefor
download)canmaketheprocessconsiderablyeasier.Thattoolwasusedinthelabteststoviewthe
http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

4/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

verboseGCdatasothatadjustmentscouldbemadeinfindingtheappropriateheapsizeforthe
DayTraderapplication.
Oneofthefirstitemstomonitorintheverbosegarbagecollectionoutputisthefreeheapafter
collection.ThismetriciscommonlyusedtodetermineifanyJavamemoryleaksarepresentwithinthe
application.Ifthismetricdoesnotreachasteadystatevalueandcontinuestodecreaseovertime,then
youhaveaclearindicationthatamemoryleakispresentwithintheapplication.Thefreeheapafter
collectionmetriccanalsobeusedinconjunctionwiththeheapsizetocalculatetheworkingsetof
memory(or"footprint")beingusedbytheserverandapplication.Simplysubtractthefreeheapvalue
fromthetotalheapsizetogetthisvalue.
Figure2.Freeheapaftercollectionsummary

BeawarethatwhiletheverboseGCdataandthechartinFigure2canhelpdetectmemoryleakswithin
theJavaheap,itcannotdetectanativememoryleak.Nativememoryleaksoccurwhennative
components(likevendornativelibrarieswritteninC/C++andcalledviatheJavaNativeInterface(JNI)
APIs)leaknativememoryoutsidetheJavaheap.Inthesesituations,itisnecessarytouseplatform
specifictools(likethepsandtopcommandsonLinuxplatforms,PerfmononWindowsplatforms,and
soon)tomonitorthenativememoryusagefortheJavaprocesses.TheWebSphereApplicationServer
Supportpagehasdetaileddocumentationondiagnosingmemoryleaks.
Twoadditionalmetricstokeyinonarethegarbagecollectionintervalsandtheaveragepausetimes
foreachcollection.TheGCintervalistheamountoftimeinbetweengarbagecollectioncycles.The
pausetimeistheamountoftimethatagarbagecollectioncycletooktocomplete.Figure3chartsthe
garbagecollectionintervalsforeachofthefourheapsizes.Theyaveragedoutto0.6seconds(256MB),
1.5seconds(512MB),3.2seconds(1024MB),and6.7seconds(2048MB).
Figure3.Garbagecollectionintervals

http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

5/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

Figure4showstheaveragepausetimesforeachofthefourheapsizes.Inlabtesting,theyaveraged
outto62ms(256MB),69ms(512MB),83ms(1024MB),and117ms(2048MB).Thisclearly
demonstratesthestandardtradeoffassociatedwithincreasingtheJavaheapsize.Asheapsize
increases,theintervalbetweenGCsincrease,enablingmoreworktobeperformedbeforetheJVM
pausestoexecuteitsgarbagecollectionroutines.However,increasingtheheapalsomeansthatthe
garbagecollectormustprocessmoreobjectsand,inturn,drivestheGCpausetimeshigher.
Figure4.Averagepausetimes

http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

6/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

TheGCintervalsandpausetimestogethermakeuptheamountoftimethatwasspentingarbage
collection.ThepercentageoftimespentingarbagecollectionisshownintheIBMMonitoringand
DiagnosticToolsforJavaGarbageCollectionandMemoryVisualizertoolandcanbecalculatedusing
thisformula:

Theamountoftimespentingarbagecollectionandtheresultingthroughput(requestspersecond)for
eachoftheserunsisdisplayedinFigure5.
Figure5.Timespentingarbagecollectionandthroughput

ArecommendedsettingforinitialandmaximumheapsizefortheDayTraderapplicationwouldtherefore
be1024MB.Atthispoint,youreachapointofdiminishingmarginalreturnswhereincreasingtheheap
sizefurtherdoesnotyieldaproportionalperformancebenefit.Thisprovidesagoodbalanceofhigher
garbagecollectionintervalsandlowerpausetimes,whichresultsinasmallamountoftimespentin
garbagecollection.
AnotherimportantaspectofJVMtuningisthegarbagecollectionpolicy.ThethreemainGCpolicies
are:
optthruput:(defaultinV7)Performsthemarkandsweepoperationsduringgarbagecollectionwhen
theapplicationispausedtomaximizeapplicationthroughput.
optavgpause:Performsthemarkandsweepconcurrentlywhiletheapplicationisrunningtominimize
pausetimesthisprovidesthebestapplicationresponsetimes.
gencon:(defaultinV8)Treatsshortlivedandlonglivedobjectsdifferentlytoprovideacombinationof
lowerpausetimesandhighapplicationthroughput.
TheDayTraderapplicationdoesnotusemanylonglivedobjectsandtypicallyrunsbestwiththedefault
optthruputGCpolicy.However,eachapplicationisdifferentandsoyoushouldevaluateeachGCpolicy
tofindthebestfitforyourapplication.ThedeveloperWorksarticleGarbagecollectionpoliciesisagreat
resourceforlearningmoreabouttheGCpolicies.
Figure6presentstheperformancegainachieved(determinedfromtheapplicationthroughput)bytuning
theJVMheapsizeforeachofthedifferentDayTraderruntimemodes.Inthechart,thebluebarsalways
representthebaselinethroughputvaluesandtheredbarsrepresentthethroughputvaluesafteradjusting
thediscussedtuningparameter.Inordertopresenttherelativethroughputdifferencesbetweenthe
variousruntimemodes,allmeasurementsarecomparedagainsttheEJBmodebaseline.
Forexample,priortotuning,SessionDirectandDirectmodeare23%and86%fasterthantheEJBmode
http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

7/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

baseline,respectively.Thelineonthesecondaryaxisrepresentstheoverallperformanceimprovement
foreachoftheruntimemodes.Inthiscase,theJVMtuningresultedinvaryingimprovementsforthe
threeruntimemodesduetotheuniqueobjectallocationpatternsassociatedwitheach.These
improvementsrangedfromonly3%(forJDBCmode)upto9%(forEJBmode).
Thisinformationwillbeshownattheendofeachtuningparameter,whereapplicable.Theperformance
improvementaftertheapplicationofeachtuningparameteriscumulative,buildingupontheparameters
fromtheprevioussections.Achartattheendofthisarticle(Figure22)exhibitstheoverallperformance
improvementachievedwithalltuningchangesapplied.
Figure6.PerformancebenefitoftunedJVMheapsize

JVMminimumheapsize=Maximumheapsize
Asmentionedearlier,itisgenerallyrecommendedthattheminimumandmaximumheapsizesaresetto
thesamevaluetomaximizeruntimeperformance.ThispreventstheJVMfromcompacting,which
dynamicallyresizestheheap.Thisisaveryexpensiveoperationandcanbeasmuchas50%ofgarbage
collectionpausetimes.Settingtheminheapsizeequaltothemaxheapsizealsomakesgarbage
collectionanalysiseasierbyfixingakeyparametertoaconstantvalue.Thetradeoffforsettingthe
minimumandmaximumheapsizestothesamevalueisthattheinitialstartupoftheJVMwillbeslower
becausetheJVMmustallocatethelargerheap.
Therearescenarioswheresettingtheminimumandmaximumheapsettingstodifferentvaluescanbe
advantageous.Onesuchscenarioiswhenmultipleapplicationserverinstancesrunningdifferent
workloadsarehostedonthesameserver.Inthisscenario,theJVMcandynamicallyrespondtothe
changingworkloadrequirementsandmoreeffectivelyutilizesystemmemory.
Toillustratethebenefitofsettingtheminimumandmaximumheapsizestothesamevalue,atestwas
donewherethemaxheapsizewasfixedat1024MB(1GB)andtheperformancewasmeasuredasthe
minheapsizewasincreased.TheresultsarechartedinFigure7below.
Figure7.Performancebenefitofsettingmin=max

http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

8/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

Thebaselineisthedefaultoutoftheboxsettingsof50MBminand256MBmax.Forthisworkload,itis
apparantthatsimplyspecifyingamaxheapsizeof1GBdoesnotprovidemuchimprovementlessthan
2%becausetheamountofcompactionissogreat.However,astheminimumheapsizeisincreasedto
closermatchthemaximumheapsize,theamountofcompactionisdecreased,whichreducesthe
amountoftimespentingarbagecollection.Thereforetheoverallapplicationthroughputincreasesby
almost10%,whichcloselymatchesthepercentageoftimespentingarbagecollectioninthedefault
configuration.
Tuningthenurserysize
InWebSphereApplicationServerV8,thedefaultgarbagecollectionpolicyhaschangedtogencon,
whichseparatestheheapintotwospaces,anurseryspaceandatenuredspace.Thenurseryspaceis
wheretheshortlivedobjectsresideand,correspondingly,thetenuredspaceiswherethelonglived
objectsreside.Objectsthatstickaroundaremovedfromthenurseryspacetothetenuredspaceaftera
certainperiodoftime.ThisisabeneficialGCpolicybecausenurserycollectionshaveamuchsmaller
pausetimethanglobalcollections.
Theimportanttuningsettinghereisthenurserysize(Xmn).Thedefaultvalueis25%ofthemaximum
heapsize,whichmeansthetenuredspaceis75%.Foranapplicationwithmostlylongerlivedobjectsthis
isaprettygoodvalue.However,forapplicationswithmoreshortlivedobjects,aperformance
improvementcanbeseenbyincreasingthenurserysize.
AtransactionbasedapplicationlikeDayTraderisanexampleofanapplicationthatwillseeabenefitfrom
alargernurserysize,becausemanyobjectsarecreatedtoperformthetransactionandthenthrownaway
oncethetransactionhascompleted.Toillustratethis,atestwasdonewiththeprevioussettingsof1024
MBmin/maxheap,withanurserysizeof256MB(default),512MB,and768MB.Theresultsareshown
inFigure8.
Figure8.Performancebenefitoftuningthenurserysize

http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

9/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

Formoreinformation:
TuningtheIBMvirtualmachineforJava
Javatechnology,IBMstyle:Garbagecollectionpolicies,Part1
IBMSupportAssistant

b.Threadpoolsize
EachtaskperformedbytheserverrunsonathreadobtainedfromoneofWebSphereApplication
Serversmanythreadpools.Athreadpoolenablescomponentsoftheservertoreusethreads,
eliminatingtheneedtocreatenewthreadsatruntimetoserviceeachnewrequest.Threeofthemost
commonlyused(andtuned)threadpoolswithintheapplicationserverare:
Webcontainer:UsedwhenrequestscomeinoverHTTP.IntheDayTraderarchitecturediagram
(Figure1),youcanseethatmosttrafficcomesintoDayTraderthroughtheWebContainerthreadpool.
Default:Usedwhenrequestscomeinforamessagedrivenbeanorifaparticulartransportchainhas
notbeendefinedtoaspecificthreadpool.
ORB:UsedwhenremoterequestscomeinoverRMI/IIOPforanenterprisebeanfromanEJB
applicationclient,remoteEJBinterface,oranotherapplicationserver.
TheimportanttunableoptionsassociatedwiththreadpoolsareshowninTable2.
Table2.Tunablethreadpooloptions
Setting Description
Minimum Theminimumnumberofthreadspermittedinthepool.Whenanapplicationserverstarts,nothreadsareinitially
size
assignedtothethreadpool.Threadsareaddedtothethreadpoolastheworkloadassignedtotheapplication
serverrequiresthem,untilthenumberofthreadsinthepoolequalsthenumberspecifiedintheminimumsize
field.Afterthispointintime,additionalthreadsareaddedandremovedastheworkloadchanges.However,the
numberofthreadsinthepoolneverdecreasesbelowthenumberspecifiedintheminimumsizefield,evenif
someofthethreadsareidle.
MaximumSpecifiesthemaximumnumberofthreadstomaintaininthedefaultthreadpool.
size
Thread Specifiestheamountofinactivity(inmilliseconds)thatshouldelapsebeforeathreadisreclaimed.Avalueof0
inactivity indicatesnottowait,andanegativevalue(lessthan0)meanstowaitforever.
timeout

Assumingthatthemachinecontainsasingleapplicationserverinstance,agoodpracticeistouse5
threadsperserverCPUcoreforthedefaultthreadpool,and10threadsperserverCPUfortheORBand
Webcontainerthreadpools.Foramachinewithupto4CPUs,thedefaultsettingsareusuallyagood
startformostapplications.Ifthemachinehasmultipleapplicationserverinstances,thenthesesizes
shouldbereducedaccordingly.Conversely,therecouldbesituationswherethethreadpoolsizemight
needtobeincreasedtoaccountforslowI/Oorlongrunningbackendconnections.Table3showsthe
http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

10/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

defaultthreadpoolsizesandinactivitytimeoutsforthemostcommonlytunedthreadpools.
Table3.Defaultthreadpoolsizesandinactivitytimeouts
Threadpool
Default
ORB
Webcontainer

Minimumsize
20
10
50

Maximumsize
20
50
50

Inactivitytimeout
5000ms
3500ms
60000ms

ThreadpoolsettingscanbechangedintheadministrativeconsolebynavigatingtoServers=>
ApplicationServers=>server_name=>ThreadPool.YoucanalsousethePerformanceAdvisorsto
getrecommendationsonthreadpoolsizesandothersettings.
TheIBMTivoliPerformanceViewerisatoolembeddedintheadministrativeconsolethatletsyouview
thePMI(PerformanceMonitoringInfrastructure)dataassociatedwithalmostanyservercomponent.The
viewerprovidesadvicetohelptunesystemsforoptimalperformanceandrecommendsalternativesto
inefficientsettings.SeetheWebSphereApplicationServerInformationCenterforinstructionson
enablingandviewingPMIdatawiththeTivoliPerformanceViewer.
Figure9showsthePMIdatafortheWebcontainerthreadpoolwhiletheDayTraderapplicationwas
rampedupandrunundersteadystate,peakload.Thepoolsize(orange)istheaveragenumberof
threadsinthepool,andtheactivecount(red)isthenumberofconcurrentlyactivethreads.Thisgraph
showsthatthedefaultsettingof50maximumWebcontainerthreadsworkswellinthiscase,asall50
threadshavenotbeenallocatedandtheaverageconcurrentworkloadisusingaround18threads.Since
thedefaultthreadpoolsizingwassufficient,nomodificationsweremadetothethreadpoolsizing.
Figure9.PMIdataforWebcontainerthreadpool

PriortoWebSphereApplicationServerV6.x,aonetoonemappingexistedbetweenthenumberof
concurrentclientconnectionsandthethreadsintheWebcontainerthreadpool.Inotherwords,if40
clientswereaccessinganapplication,40threadswereneededtoservicetherequests.InWebSphere
ApplicationServerV6.0and6.1,NativeIO(NIO)andAsynchronousIO(AIO)wereintroduced,providing
theabilitytoscaletothousandsofclientconnectionsusingarelativelysmallnumberofthreads.This
explainswhy,inFigure9,anaverageof18threadswereusedtoservice50concurrentclient
connectionsfromtheHTTPloaddriver.Basedonthisinformation,thethreadpoolsizecouldbelowered
toreducetheoverheadinvolvedwithmanagingalargerthanneededthreadpool.However,thiswould
lessentheabilityoftheservertorespondtoloadspikesinwhichalargenumberofthreadswereactually
needed.Carefulconsiderationshouldbetakenindeterminingthethreadpoolsizes,includingwhatthe
http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

11/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

expectedaverageandpeakworkloadcouldpotentiallybe.

c.Connectionpoolsize
Eachtimeanapplicationattemptstoaccessabackendstore(suchasadatabase),itrequiresresources
tocreate,maintain,andreleaseaconnectiontothatdatastore.Tomitigatethestrainthatthisprocess
canplaceonoverallapplicationresources,theapplicationserverenablesyoutoestablishapoolofback
endconnectionsthatapplicationscanshareonanapplicationserver.Connectionpoolingspreadsthe
connectionoverheadacrossseveraluserrequests,therebyconservingapplicationresourcesforfuture
requests.TheimportanttunableoptionsassociatedwithconnectionpoolsareshowninTable4.
Table4.Connectionpooltuningoptions
Setting
Description
Minimum
Theminimumnumberofphysicalconnectionstomaintain.Ifthesizeoftheconnectionpoolisatorbelowthe
connectionsminimumconnectionpoolsize,anunusedtimeoutthreadwillnotdiscardphysicalconnections.However,
thepooldoesnotcreateconnectionssolelytoensurethattheminimumconnectionpoolsizeismaintained.
Maximum Themaximumnumberofphysicalconnectionsthatcanbecreatedinthispool.Thesearethephysical
connectionsconnectionstothebackenddatastore.Whenthisnumberisreached,nonewphysicalconnectionsare
createdrequestorsmustwaituntilaphysicalconnectionthatiscurrentlyinuseisreturnedtothepool,or
untilaConnectionWaitTimeoutExceptionisthrown,basedontheconnectiontimeoutsetting.Settingahigh
maximumconnectionsvaluecanresultinaloadofconnectionrequeststhatoverwhelmsyourbackend
resource.
Thread
Specifiestheamountofinactivity(inmilliseconds)thatshouldelapsebeforeathreadisreclaimed.Avalueof
inactivity
0indicatesnottowait,andanegativevalue(lessthan0)meanstowaitforever.
timeout

Thegoaloftuningtheconnectionpoolistoensurethateachthreadthatneedsaconnectiontothe
databasehasone,andthatrequestsarenotqueuedupwaitingtoaccessthedatabase.Forthe
DayTraderapplication,eachtaskperformsaqueryagainstthedatabase.Sinceeachthreadperformsa
task,eachconcurrentthreadneedsadatabaseconnection.Typically,allrequestscomeinoverHTTP
andareexecutedonaWebcontainerthread.Therefore,themaximumconnectionpoolsizeshouldbeat
leastaslargeasthemaximumsizeoftheWebcontainerthreadpool.
Beaware,though,thisisnotabestpracticeforallscenarios.Usingaconnectionpoolaslargeorlarger
thantheWebcontainerthreadpoolensuresthattherearenothreadswaitingforaconnectionand
providesthemaximumperformanceforasingleserver.However,foranenvironmentthathasnumerous
applicationserversallconnectingtothesamebackenddatabase,carefulconsiderationshouldbeplaced
ontheconnectionpoolsize.If,forexample,therearetenapplicationserversallaccessingadatabase
with50connectionsintheconnectionpool,thatmeansupto500connectionscouldberequestedata
timeonthedatabase.Thistypeofloadcouldeasilycauseproblemsonthedatabase.
Abetterapproachhereistousethe"funneling"method,inwhichthenumberofWebcontainerthreadsis
largerthanthenumberofconnectionsintheconnectionpool.Thisensuresthatunderextremeload,not
allactivethreadsaregettingaconnectiontothedatabaseatasinglemoment.Thiswillproducelonger
responsetimes,butwillmaketheenvironmentmuchmorestable.
Overall,thegeneralbestpracticeistodeterminewhichthreadpoolsservicetasksthatrequirea
DataSourceconnectionandtosizethepoolsaccordingly.Inthiscase,sincewearefocusedonachieving
thebestperformanceforasingleserver,themaximumconnectionpoolsizewassettothesumofthe
maximumsizeofthedefaultandWebcontainerthreadpools(70).Theconnectionpoolsettingscanbe
changedintheadministrativeconsolebynavigatingtoResources=>JDBC=>DataSources=>
data_source=>Connectionpoolproperties.Bearinmindthatallapplicationsmightnotbeaswell
behavedasDayTraderfromaconnectionmanagementperspective,andthereforemightusemorethan
oneconnectionperthread.
Figure10showsthePMIdatafortheconnectionpoolwhiletheDayTraderapplicationwasrunningunder
steadystatepeakloadwiththedefaultconnectionpoolsizesof1minimum/10maximum.FreePoolSize
http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

12/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

(orange)isthenumberoffreeconnectionsinthepoolandUseTime(green)istheaveragetime(inms)
thataconnectionisused.Thisgraphshowsthatall10connectionswerealwaysinuse.Inadditiontothe
chartedmetrics,thetablealsoshowssomeotherkeymetrics:WaitingThreadCountshows33threads
waitingforaconnectiontothedatabasewithanaverageWaitTimeof8.25ms,andthepooloverallis
100%occupied,asshownbythePercentUsedmetric.
Figure10.PMImetricsbeforetuningtheconnectionpool

Figure11showsthesamechartaftertuningtheconnectionpooltoasizeof10minimum/70maximum.
Thisshowsthattherewereplentyoffreeconnectionsavailableandnothreadswerewaitingfora
connection,whichproducesmuchfasterresponsetimes.
Figure11.PMImetricsaftertuningtheconnectionpool

Figure12.Performancebenefitoftunedconnectionpoolsizes

http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

13/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

Formoreinformation:
Tuningapplicationservers
Dataaccesstuningparameters
Whyyouwanttousetheperformanceadvisors

d.Datasourcestatementcachesize
DatasourcestatementcachesizespecifiesthenumberofpreparedJDBCstatementsthatcanbe
cachedperconnection.TheWebSphereApplicationServerdatasourceoptimizestheprocessingof
preparedstatementsandcallablestatementsbycachingthosestatementsthatarenotbeingusedinan
activeconnection.IfyourapplicationutilizesmanystatementslikeDayTraderdoes,thenincreasingthis
parametercanimproveapplicationperformance.Thestatementcachesizecanbeconfiguredby
navigatingtoResources=>JDBC=>Datasources=>data_source=>WebSphereApplication
Serverdatasourceproperties.
Thedatasourcestatementcachesizecanbetunedusingafewdifferentmethods.Onetechniqueisto
reviewtheapplicationcode(oranSQLtracegatheredfromthedatabaseordatabasedriver)forall
uniquepreparedstatements,andensurethecachesizeislargerthanthatvalue.Theotheroptionisto
iterativelyincreasethecachesizeandruntheapplicationunderpeaksteadystateloaduntilthePMI
metricsreportnomorecachediscards.Figure13showsthesamePMIchartoftheconnectionpool,this
timewiththedatasourcestatementcachesizeincreasedfromthedefaultsize(whichis10)to60.The
metricPrepStmtCacheDiscardCount(red)isthenumberofstatementsthatarediscardedbecausethe
cacheisfull.LookingbackatthechartinFigure11,beforetuningthedatasourcestatementcachesize,
thenumberofstatementsdiscardedwasover1.7million.ThechartinFigure13showstherewereno
statementdiscardsaftertuningthecachesize.
Figure13.PMImetricsaftertuningthedatasourcestatementcachesize

http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

14/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

Figure14.Performancebenefitofincreaseddatasourcestatementcachesize

Formoreinformation:
Dataaccesstuningparameters

e.ORBpassbyreference
TheObjectRequestBroker(ORB)passbyreferenceoptiondeterminesifpassbyreferenceorpassby
valuesemanticsshouldbeusedwhenhandlingparameterobjectsinvolvedinanEJBrequest.This
optioncanbefoundintheadministrativeconsolebynavigatingtoServers=>ApplicationServers=>
server_name=>ObjectRequestBroker(ORB).Bydefault,thisoptionisdisabledandacopyofeach
parameterobjectismadeandpassedtotheinvokedEJBmethod.Thisisconsiderablymoreexpensive
thanpassingasimplereferencetotheexistingparameterobject.
Tosummarize,theORBpassbyreferenceoptionbasicallytreatstheinvokedEJBmethodasalocalcall
(evenforEJBswithremoteinterfaces)andavoidstherequisiteobjectcopy.Ifremoteinterfacesarenot
absolutelynecessary,aslightlysimpleralternativewhichdoesnotrequiretuningistouseEJBswithlocal
interfaces.However,byusinglocalinsteadofremoteinterfaces,youlosethebenefitscommonly
associatedwithremoteinterfaces,locationtransparencyindistributedenvironments,andworkload
managementcapabilities.
TheORBpassbyreferenceoptionwillonlyprovideabenefitwhentheEJBclient(thatis,servlet)and
invokedEJBmodulearelocatedwithinthesameclassloader.ThisrequirementmeansthatboththeEJB
clientandEJBmodulemustbedeployedinthesameEARfileandrunningonthesameapplication
http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

15/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

serverinstance.IftheEJBclientandEJBmodulesaremappedtodifferentapplicationserverinstances
(oftenreferredtoassplittier),thentheEJBmodulesmustbeinvokedremotelyusingpassbyvalue
semantics.
BecausetheDayTraderapplicationcontainsbothWEBandEJBmodulesinthesameEAR,andbothare
deployedtothesameapplicationserverinstance,theORBpassbyreferenceoptioncanbeusedto
realizeaperformancegain.AsindicatedbythemeasurementsshowninFigure15,thisoptionis
extremelybeneficialforDayTraderwhereallrequestsfromtheservletsarepassedtothestateless
sessionbeansoveraremoteinterfaceexceptindirectmode,wheretheEJBcontainerisbypassedin
lieuofdirectJDBCandmanualtransactions.
Figure15.PerformancebenefitofORBpassbyreference

Formoreinformation:
ObjectRequestBrokertuningguidelines

Advancedtuning
Discussedinthissection:
a. Servletcaching
b. HTTPtransportpersistentconnections
c. Largepagesupport
d. Disablingunusedservices
e. Webserverlocation

a.Servletcaching
WebSphereApplicationServersDynaCacheprovidesageneralinmemorycachingserviceforobjects
andpagefragmentsgeneratedbytheserver.TheDistributedMapandDistributedObjectCacheinterfaces
canbeusedwithinanapplicationtocacheandshareJavaobjectsbystoringreferencestotheseobjects
inthecacheforlateruse.Servletcaching,ontheotherhand,enablesservletandJSPresponse
fragmentstobestoredandmanagedbyacustomizablesetofcachingrules.
IntheDayTraderapplication,aMarketSummaryisdisplayedoneveryaccessofauser'shomepage.
Thissummarycontainsalistofthetopfivegainingandlosingstocks,aswellasthecurrentstockindex
andtradingvolume.Thisactivityrequirestheexecutionofseveraldatabaselookupsandtherefore
significantlydelaystheloadingoftheuser'shomepage.Withservletcaching,themarketSummary.jsp
canbecached,virtuallyeliminatingtheseexpensivedatabasequeriestoimprovetheresponsetimefor
theuserhomepage.Therefreshintervalforthecachedobjectcanbeconfigured,andissetto60
secondsintheexampleshowninListing1.Dynacachecouldalsobeusedtocacheotherservlet/JSP
fragmentsanddatawithinDayTrader.Thisexampledemonstratestheimprovementyoucanachieve
throughcachingtoavoidcomplexserveroperations.
http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

16/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

ServletcachingcanbeenabledintheadministrativeconsolebynavigatingtoServers=>Application
servers=>server_name=>Webcontainersettings=>Webcontainer.TheURIpathtotheservletor
JSPtobecachedmustbedefinedinacachespec.xmlfile,whichisplacedinsidetheWebmodule's
WEBINFdirectory.ForthemarketSummary.jspinDayTrader,thecachespec.xmllookssimilartoListing
1.
Listing1.cachespec.xml

Figure16.Performancebenefitofservletcaching

Formoreinformation:
Taskoverview:Usingthedynamiccacheservicetoimproveperformance
Configuringcacheableobjectswiththecachespec.xmlfile

b.HTTPtransportpersistentconnections
PersistentconnectionsspecifythatanoutgoingHTTPresponseshoulduseapersistent(keepalive)
connectioninsteadofaconnectionthatclosesafteronerequestorresponseexchangeoccurs.Inmany
cases,aperformanceboostcanbeachievedbyincreasingthemaximumnumberofpersistentrequests
thatarepermittedonasingleHTTPconnection.SSLconnectionscanseeasignificantperformancegain
byenablingunlimitedpersistentrequestsperconnectionbecauseSSLconnectionsincurthecostly
overheadofexchangingkeysandnegotiatingprotocolstocompletetheSSLhandshakeprocess.
Maximizingthenumberofrequeststhatcanbehandledperconnectionminimizestheimpactofthis
overhead.Also,highthroughputapplicationswithfastresponsetimescanrealizeaperformancegainby
keepingtheconnectionsopen,ratherthanbuildingupandclosingtheconnectiononeachrequest.When
thispropertyissetto0(zero),theconnectionstaysopenaslongastheapplicationserverisrunning.
However,ifsecurityisaconcern,thencarefulconsiderationshouldbeplacedonthissetting,asthis
parametercanhelppreventdenialofserviceattackswhenaclienttriestoholdontoakeepalive
connection.
HTTPtransportpersistentconnectionssettingscanbesetintheadministrativeconsolebynavigatingto
Servers=>Applicationservers=>server_name=>Ports.Oncethere,clickonViewassociated
transportsfortheportassociatedwiththeHTTPtransportchannelsettingsyouwanttochange.
http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

17/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

DuringDayTradertesting,theMaximumpersistentrequestsperconnectionvaluewaschangedfrom
100(thedefault)tounlimited.ThechartsinFigure17showthethroughputresultsofaccessingasimple
"HelloWorld"servletoverstandardHTTP(nonSSL)andHTTPS(SSL),bothbeforeandafterenabling
unlimitedpersistentrequestsperconnection.
Figure17.Performancebenefitofunlimitedpersistentrequestsperconnection

Formoreinformation:
HTTPtransportchannelsettings

c.Largepagesupport
Severalplatformsprovidetheabilitytoestablishalargecontiguoussectionofmemoryusingmemory
pagesthatarelargerthanthedefaultmemorypagesize.Dependingontheplatform,largememorypage
sizescanrangefrom4MB(Windows)to16MB(AIX)versusthedefaultpagesizeof4KB.Many
applications(includingJavabasedapplications)oftenbenefitfromlargepagesduetoareductioninCPU
overheadassociatedwithmanagingsmallernumbersoflargepages.
Inordertouselargememorypages,youmustfirstdefineandenablethemwithintheoperatingsystem.
Eachplatformhasdifferentsystemrequirementsthatmustbeconfiguredbeforelargepagesupportcan
beenabled.TheWebSphereApplicationServerInformationCenterdocumentseachofthesestepsby
platform:
TuningAIXsystems
TuningLinuxsystems
TuningSolarissystems
TuningWindowssystems
Onceconfiguredwithintheoperationsystem,largepagesupportwithintheJVMcanbeenabledby
specifying-XlpintheGenericJVMArgumentssettingsintheadministrativeconsoleatServers=>
Applicationservers=>server_name=>Processdefinition=>JavaVirtualMachine.Beawarethat
iflargepagesareenabled,theoperatingsystemwillsetasidealargecontinuouschunkofmemoryfor
usebytheJVM.Iftheamountofmemoryremainingisnotenoughtohandletheotherapplicationsthat
arerunning,paging(swappingpagesinmemoryforpagesontheharddisk)couldoccur,whichwill
significantlyreducesystemperformance.
Figure18.Performancebenefitoflargepages

http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

18/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

Formoreinformation:
TuningtheIBMvirtualmachineforJava
JavaSupportforLargeMemoryPages

d.Disablingunusedservices
Disablingunusedservicesthatanapplicationdoesn'tneedcanimproveperformance.Onesuchexample
isPMI.ItisimportanttonotethatPMImustbeenabledtoviewthemetricsdocumentedearlierinthis
articleandtoreceiveadvicefromtheperformanceadvisors.WhiledisablingPMIremovestheabilityto
seethisinformation,italsoprovidesasmallperformancegain.PMIcanbedisabledonanindividual
applicationserverbasisintheadministrativeconsolebynavigatingtoMonitoringandTuning=>
PerformanceMonitoringInfrastructure(PMI).
Figure19.PerformancebenefitofdisablingPMI

Formoreinformation:
EnablingPMIdatacollection

e.Webserverlocation
WebserverslikeIBMHTTPServerareoftenusedinfrontofWebSphereApplicationServerdeployments
tohandlestaticcontentortoprovideworkloadmanagement(WLM)capabilities.Inversionsofthe
WebSphereApplicationServerpriortoV6,Webserverswerealsoneededtoeffectivelyhandle
thousandsofincomingclientconnections,duetotheonetoonemappingbetweenclientconnections
andWebcontainerthreads(discussedearlier).InWebSphereApplicationServerV6andlater,thisisno
longerrequiredwiththeintroductionofNIOandAIO.ForenvironmentsthatuseWebservers,theWeb
serverinstancesshouldbeplacedondedicatedsystemsseparatefromtheWebSphereApplication
Serverinstances.IfaWebserveriscollocatedonasystemwithaWebSphereApplicationServer
instance,theywilleffectivelysharevaluableprocessorresources,reducingoverallthroughputforthe
configuration.
ADayTradertestwasconductedwithIBMHTTPServerplacedlocallyonthesamemachineas
http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

19/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

WebSphereApplicationServer,andasecondtestwasconductedwiththeWebserverlocatedremotely
onaseparatededicatedmachine.Table5showsthepercentageofCPUcyclesconsumedbyeach
processwhentheWebserverandapplicationserverwerecollocatedonthesamesystem.Asyoucan
seefromtheresults,approximately25%oftheCPUwasconsumedbytheHTTPServerprocessthat
correspondstoasingleCPUinthefourCPUsystemthatwasusedforthistest.
Table5.CPUutilizationwithHTTPServer
Process
WebSphereApplicationServer
IBMHTTPServer

CPU%
66.3
26.2

Figure20showsthethroughputandresponsetimecomparisonofthesetwoscenarios,aswellasthe
casewheretherewasnoWebserveratall.
Figure20.ThroughputwithandwithoutaWebserver

Asynchronousmessagingtuning
ThemajorityofthispaperhasfocusedsofaronthecoreWebservingandpersistenceaspectsofthe
DayTraderapplicationandWebSphereApplicationServer.WewillnowshiftfocustohowDayTrader
usesJMScomponentstoperformasynchronousprocessingofbuy/sellordersandtomonitorpricequote
changes.TheDayTraderbenchmarkapplicationcontainstwomessagingfeaturesthatcanbe
independentlyenabledordisabled:
Asyncorderprocessing:AsynchronousbuyandsellorderprocessingishandledbyaJMSqueueand
anMDB.
Quotepriceconsistencytracking:AJMStopicandMDBareusedtomonitorquotepricechanges
associatedwithstockbuyandsellorders.
Therearetwoprimarytuningoptionsassociatedwiththemessagingconfigurationthatwillhavea
significantimpactonperformance:themessagestoretype,andthemessagereliability.Alongwiththese,
amoreadvancedtuningtechniquethatwillyieldadditionalperformancegainsisplacingthetransaction
logsandfilestore(ifapplicable)onafastdisk.Eachofthesetopicsandtheircorrespondingperformance
gainsarediscussedindetailbelow.
Discussedinthissection:
a. Messagestoretype
b. Messagereliabilitylevels
c. Movingtransactionlogandfilestoretoafastdisk

a.Messagestoretype
WebSphereApplicationServersinternalmessagingprovidermaintainstheconceptofamessaging
engine"datastore."Thedatastoreservesasthepersistentrepositoryformessageshandledbythe
http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

20/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

engine.Whenamessagingengineiscreatedinasingleserverenvironment,afilebasedstoreiscreated
touseasthedefaultdatastore.InWebSphereApplicationServerV6.0.x,thedefaultdatastorewas
providedbyalocal,inprocessDerbydatabase.ThefileandDerbybaseddatastoresareconvenientfor
insingleserverscenarios,butdonotprovidethehighestlevelofperformance,scalability,manageability,
orhighavailability.Tomeettheserequirements,youcanusearemotedatabasedatastore:
LocalDerbydatabasedatastore:Withthisoption,alocal,inprocessDerbydatabaseisusedtostore
theoperationalinformationandmessagesassociatedwiththemessagingengine.Althoughconvenient
fordevelopmentpurposes,thisconfigurationusedvaluablecyclesandmemorywithintheapplication
servertomanagethestoredmessages.
Filebaseddatastore:(default)Ifthemessageengineisconfiguredtouseafilebaseddatastore,
operatinginformationandmessagesarepersistedtothefilesysteminsteadofadatabase.This
performsfasterthanthelocalDerbydatabaseand,whenafastdisksuchasaredundantarrayof
independentdisks(RAID)isused,canperformjustasfastasaremotedatabase.Thetestresults
shownbelowdidnotuseaRAIDdeviceforthefilebaseddatastoreanddonotreflectthisadditional
improvement.
Remotedatabasedatastore:Inthisconfiguration,adatabaseresidingonaremotesystemis
configuredtoactasthemessageenginedatastore.ThisfreesupcyclesfortheapplicationserverJVM
processthatwerepreviouslyusedtomanagetheDerbydatabaseorfilebasedstores,enablingamore
performant,productionleveldatabaseserver(suchasIBMDB2EnterpriseServer)tobeused.One
technicaladvantageofusingadatabaseforthedatastoreisthatsomeJ2EEapplicationscanshare
JDBCconnectionstobenefitfromonephasecommitoptimization.Formoreinformationseeinformation
onsharingconnectionstobenefitfromonephasecommitoptimization.Filestoredoesnotsupportthis
optimization.
DayTraderwasruninEJBasynchronousmodewiththesethreedifferentmessagestoretypes.During
theseruns,thetracespecificationorg.apache.geronimo.samples.daytrader.util.Log=allwasenabledto
capturethetimetoreceivemessagesfortheTradeBrokerMDB.Whenmeasuringasynchronous
messagingperformance,itisalwaysimportanttobasethemeasurementsontheMDBresponsetimes
thatareasynchronousandnottheactualpageresponsetimes,whicharesynchronous.Theresultsin
Figure21showthataremotedatabasedatastoreyieldsthebestperformance,asitprovidesthefastest
MDBresponsetimeandthehighestthroughput.
Figure21.Performancecomparisonofmessagestoretypes

Formoreinformation:
Relativeadvantagesofafilestoreandadatastore

b.Messagereliabilitylevels
http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

21/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

MessagereliabilityisanimportantcomponentforanymessagingsystemandtheWebSphereApplication
Servermessagingproviderprovidesfivedifferentlevelsofreliability:
Besteffortnonpersistent
Expressnonpersistent
Reliablenonpersistent
Reliablepersistent
Assuredpersistent.
Persistentmessagesarealwaysstoredtosomeformofpersistentdatastore,whilenonpersistent
messagesaregenerallystoredinvolatilememory.Thereisatradeoffherebetweenreliabilityof
messagedeliveryandthespeedwithwhichmessagesaredelivered.Figure22showstheresultsfortwo
testrunsusingafilestorewithdifferentreliabilitylevels:assuredpersistentandexpressnonpersistent.
Theresultsclearlyillustratethatasthereliabilityleveldecreases,thefasterthemessagescanbe
processed.
Figure22.Performancecomparisonofmessagereliabilitylevels

Formoreinformation:
MessagereliabilitylevelsJMSdeliverymodeandserviceintegrationqualityofservice

c.Movingtransactionlogandfilestoretoafastdisk
SincediskI/Ooperationsarecostly,storinglogfilesonfastdiskssuchasaRAIDcangreatlyimprove
performance.InmostRAIDconfigurations,thetaskofwritingdatatothephysicalmediaissharedacross
themultipledrives.Thistechniqueyieldsmoreconcurrentaccesstostorageforpersistingtransaction
information,andfasteraccesstothatdatafromthelogs.
TheTransactionlogdirectorycanbesetintheadministrativeconsolebynavigatingtoServers=>
ApplicationServers=>server_name=>ContainerServices=>TransactionService.
TheFilestorelogdirectorycanbespecifiedduringthecreationofanSIBusmemberusingthelogDirectoryoptionintheAdminTask addSIBusMembercommandorviatheadministrationconsole

SIBusMembercreationpanels.
Figure23showstheresultsfortwotestruns:onewiththetransactionlogsandfilestorestoredlocallyon
theharddrive,andtheotherwiththemstoredonaRAMDisk(whichessentiallytreatsasectionof
memoryasaharddiskforfasterreadsandwrites).Fortheseruns,areliabilitylevelofexpressnon
persistentwasused.Theresultsshowthattheresponsetimesandthroughputareslightlyfasterwhen
thelogsarestoredonafastdisk.
Figure23.Performancebenefitofusingafastdisk
http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

22/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

Formoreinformation:
Transactionservicesettings
addSIBusMembercommand

Summary
IBMWebSphereApplicationServerhasbeendesignedtohostanevergrowingrangeofapplications,
eachwiththeirownuniquesetoffeatures,requirements,andservices.Thisflexibilityaffirmsthereality
thatnotwoapplicationswillusetheapplicationserverinexactlythesameway,andnosinglesetof
tuningparameterswilllikelyprovidethebestperformanceforanytwodifferentapplications.
EventhoughDayTradermightnotresembleyourapplication,themethodologyforfiguringoutwhatto
tuneandhowtogoabouttuningitisthesame.Thekeyistoidentifyandfocusinonthemajorserver
componentsandresourcesusedbyyourapplication,basedontheapplicationarchitecture.Ingeneral,a
largenumberofapplicationswillrealizesomeimprovementfromtuninginthreecoreareas:theJVM,
threadpools,andconnectionpools.Othertunablesmightyieldjustasmuchbangforthebuckhowever,
thesewilltypicallybetiedtoaspecificWebSphereApplicationServerfeatureusedbytheapplication.
ThisarticlediscussedthiscoresetoftunablesplusotheroptionsthatbenefittheDayTraderapplication.
Foreachoftheoptions,youweregiveninformationonwheretofindthetunable,general
recommendationsorcautionsaboutanytradeoffs,andpointerstorelatedtools,ifany.Figure24shows
theoverallperformanceimprovementforeachDayTraderruntimemodeafterthesetuningoptionswere
applied:
JVMheapsize
Threadpoolsize
Connectionpoolsize
Datasourcestatementcachesize
ORBpassbyreference
Servletcaching
UnlimitedpersistentHTTPconnections
Largepagesupport
DisablingPMI.
Figure24.Overallperformanceimprovementsaftertuningoptionsapplied

http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

23/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

Asyoucanclearlyseefromthefigure,thedescribedtuningyielded169%improvementforEJBmode,
207%improvementforSessionDirectmode,and171%improvementforDirectmode.Thesearefairly
sizableimprovementsandsimilarimprovementscanberealizedinotherapplicationshowever,youmust
keepinmindthatyourresultswillvarybasedonthefactorsdiscussedearlier,andonotherfactorsthat
arebeyondthescopeofthisarticle.
Hopefully,theinformationandtoolsdiscussedherehaveprovidedyouwithsomekeyinsightsthatwill
helpmakethetaskoftuningyourapplicationserverforyourspecificapplicationslessdauntingandeven
lessintimidating.

Resources
Learn
GarbagecollectioninWebSphereApplicationServerV8,Part1:Generational
asthenewdefaultpolicy
What'snewinWebSphereApplicationServerV8

DigdeeperintoWebSphereon
developerWorks
Overview
NewtoWebSphere
Technicallibrary(tutorialsandmore)
Forums

WebSphereApplicationServerInformationCenters(allversions)

Community

WebSphereApplicationServerSupport

Downloads

InformationCenter:
TuningtheIBMvirtualmachineforJava
Performanceadvisortypesandpurposes
UsingtheperformanceadvisorinTivoliPerformanceViewer
Tuningapplicationservers
Dataaccesstuningparameters
Whyyouwanttousetheperformanceadvisors
ObjectRequestBrokertuningguidelines
Taskoverview:Usingthedynamiccacheservicetoimproveperformance
Configuringcacheableobjectswiththecachespec.xmlfile
HTTPtransportchannelsettings
TuningAIXsystems
TuningLinuxsystems
TuningSolarissystems
TuningWindowssystems

Products
Events

BluemixDevelopers
Community
Getsamples,articles,product
docs,andcommunityresourcesto
helpbuild,deploy,andmanage
yourcloudapps.

developerWorksWeekly
Newsletter
Keepupwiththebestandlatest
technicalinfotohelpyoutackle
yourdevelopmentchallenges.

DevOpsServices
Softwaredevelopmentinthecloud.
Registertodaytocreateaproject.

IBMevaluationsoftware
EvaluateIBMsoftwareand
solutions,andtransform
challengesintoopportunities.

EnablingPMIdatacollection
Relativeadvantagesofafilestoreandadatastore
MessagereliabilitylevelsJMSdeliverymodeandserviceintegration
qualityofservice
http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

24/25

28/11/2015

Casestudy:TuningWebSphereApplicationServerV7andV8forperformance

Transactionservicesettings
addSIBusMembercommand
Javatechnology,IBMstyle:Garbagecollectionpolicies,Part1
JavaSupportforLargeMemoryPages
IBMdeveloperWorksWebSphere
Getproductsandtechnologies
ApacheDayTraderBenchmarkSample
IBMWebSphereApplicationServerV8trialdownload
IBMSupportAssistant

http://www.ibm.com/developerworks/websphere/techjournal/0909_blythe/0909_blythe.html

25/25

Вам также может понравиться