Académique Documents
Professionnel Documents
Culture Documents
eLearningCourseTranscript
Copyright 2008
Pegasystems Inc., Cambridge, MA
Allrightsreserved.
ThisdocumentdescribesproductsandservicesofPegasystemsInc.Itmaycontaintradesecrets
andproprietaryinformation.Thedocumentandproductareprotectedbycopyrightand
distributedunderlicensesrestrictingtheiruse,copyingdistribution,ortransmittalinanyform
withoutpriorwrittenauthorizationofPegasystemsInc.
Thisdocumentiscurrentasofthedateofpublicationonly.Changesinthedocumentmaybe
madefromtimetotimeatthediscretionofPegasystems.Thisdocumentremainstheproperty
ofPegasystemsandmustbereturnedtoituponrequest.Thisdocumentdoesnotimplyany
commitmenttoofferordelivertheproductsorservicesdescribed.
ThisdocumentmayincludereferencestoPegasystemsproductfeaturesthathavenotbeen
licensedbyyourcompany.Ifyouhavequestionsaboutwhetheraparticularcapabilityis
includedinyourinstallation,pleaseconsultyourPegasystemsserviceconsultant.
ForPegasystemstrademarksandregisteredtrademarks,allrightsreserved.Otherbrandor
productnamesaretrademarksoftheirrespectiveholders.
AlthoughPegasystemsInc.strivesforaccuracyinitspublications,anypublicationmaycontain
inaccuraciesortypographicalerrors.ThisdocumentorHelpSystemcouldcontaintechnical
inaccuraciesortypographicalerrors.Changesareperiodicallyaddedtotheinformationherein.
PegasystemsInc.maymakeimprovementsand/orchangesintheinformationdescribedherein
atanytime.
Thisdocumentisthepropertyof:
PegasystemsInc.
101MainStreet
Cambridge,MA021421590
Phone:(617)3749600
Fax:(617)3749620
www.pega.com
Updated:March18,2008
Contents
Root Causes of Performance Issues ..................................................................................................... 1
Performance Analysis Checklist............................................................................................................ 2
Identifying Design Time Warnings with Preflight................................................................................. 2
Design Time Warnings When Creating Classes................................................................................... 2
List View Unit Testing Considerations .................................................................................................. 4
Troubleshooting List View Report Performance .................................................................................. 4
Design Time Warnings for Java Activity Method ................................................................................. 5
Design Time Warnings for WriteNow and Obj-Save ............................................................................ 6
Using the MyAlerts Tool to Unit Test Rule Performance..................................................................... 6
Optimizing Query Performance with DB Time Alert ............................................................................ 7
Optimizing Performance with Browser Interaction Alert..................................................................... 8
Optimizing Performance with DB Bytes Read Alert............................................................................. 8
Optimizing Performance with Connect Total Time Alert ..................................................................... 9
Uncovering Hidden Performance Issues with PAL .............................................................................. 9
Using Alert and Error Logs to Enhance Performance ....................................................................... 12
Blob Data Retrieval and Performance Implications ........................................................................... 12
RootCausesofPerformanceIssues
Overallperformanceisafunctionofhoweachofthemaincomponents
performswithinanapplication,whichinPRPCincludesthefollowing:
Browser
PegaRULESdatabaseserver
OtherSystemsaccessedviaconnectorsandservices
ApplicationserverinwhichPRPCresides
Networkeachofthesecomponentsusestocommunicate
Eachcomponenthasacapacity,andwhentheloadonthatcapacityapproaches
itslimit,performancebeginstosuffer.Forinstance,
CPUcanbecomeabottleneckwhendeveloperswriteinefficientprocessing
logic
TheApplicationServersJavaVirtualMachine(JVM)showsstressintermsof
garbagecollectionoverheadwhentoomuchmemory(intheformof
clipboardpages)isused
Whenwesendand/orreceivetoomuchdata,pressureisplacedonthe
network,thedatabase,thebrowser,andtheCPUcombined
Responsetimeproblemsarecreatedwhenanapplicationthatforeach
requestrequirestoomanyseparatedatarequestsduetonetworklatency.
Thisisespeciallytrueingeographicallydisbursedarchitectures.
Thesecapacitylimitationsshouldbeconsideredwhendesigningandcreating
PRPCrules.ThePRPCapplicationservercomponentisintheidealpositionto
notonlyprovideaviewofitsownloadontheapplicationserver,butitcanalso
observetheperformanceofthecomponentsinwhichitcommunicates.
PerformanceAnalysisChecklist
WhendesigningaPRPCapplication,considerthesefourchecklistitemsto
ensureyouaddressperformanceissuesearly.
1. DesignTimeWarnings:BeattentivetoPRPCwarnings.Theyindicate
whensomethingmaynotbequiterightwithoneofyourrules.
2. PerformanceAlerts:Whenunittesting,ensurerulesrunwithinthe
expectedSLAtimeandtheydonotusesystemresourcesabovecertain
presetthresholds.
3. PAL:InspecttheunittestedruntimestatisticsofPALtoidentify
indicationsofabnormalusage.
4. ApplicationFunctionality:Ensuretherearenobehindthesceneserrors
thatmayhaveperformanceimplications.
IdentifyingDesignTimeWarningswithPreflight
Tobeginlookingfordesigntimewarnings,startwiththePreFlighttool,which
showsthenumberofviolationsofPRPCbestpractices.
Fromaperformanceperspective,payparticularattentiontowarningsonrule
typesrelatedto:
Class
ListView
Activity
Toeditarule,expandeachRuleTypeandclickontheruleyouwishtoedit.
DesignTimeWarningsWhenCreatingClasses
AsignificantdesigntimewarningpertainstohowthePRPCconcreteclassesthat
persistdataaremappedtotheunderlyingdatabasetables.
AsignificantadvantageofPRPCistheabilitytocreatenewconcreteclasses,add
properties,andneverinvolvetheDBAinthedaytodayiterativedevelopment.
Thisallowsthedevelopertofocusonrulesdevelopment,rapidlycreatethe
application,andtestitforfunctionalcompletenesswithouthavingtoinvolve
theDBAateachsteptomaintainaschemathatmatchestheapplication.
PRPCsdefaultmappingofconcreteclassesistooneoffourdefault(andvery
generic)tables:
PR_OTHER
PR_DATA
PR_HISTORY
PR_INDEX
Thesetablesarebarebonesanddonothaveexposedcolumnsnorindexesto
supportyourqueries.
TheclassthatholdstheHomeCodesdatashowsawarning.Rulescansaveas
Valid;however,itmaycontainawarning.Looktothebottomoftheruleforthe
associatedwarningmessages.
Whennewclassesarecreated,bydefaulttheyaremappedtoPR_OTHER.
Whentheapplicationisdeployed,ideallynoclassesshouldbemappedtoanyof
thefourdefaulttables.
Youcanremapconcreteclassestodatabasetablesquicklyandeasily
Usingtheclassexplorer,navigatetotheDataAdminDBTableinstances,which
showthemappingofPRPCclassestodatabasetablenames.
Thismappingtakesintoaccountaformofpatterninheritance.Forexample,a
classnamedDataAdminXXXwouldmaptopr_data_admin,yetaclassnamed
DataMyRulesXXXXwouldmaptoPR_DATA.Iftherearenomatchingmapping
rowsfound,themappingisassumedtobePR_OTHER.
Tofixthisproblem,createanewinstancerow,suchasUServData
HomeCodes,andmapittoanewdatabasetable,suchasHomeCodes.
HavetheDBAmodelthisnewtablefromPR_OTHER.UsePC_WORKifit
wasaworkobjecttable.
Thedevelopercanalsocreateindexesiffilteringisneeded.
AftertheclassismappedandtheDBAhascreatedthenewHomeCodestable,
testthattheconnectiontothenewtableisworkingproperlydirectlyfromthe
classrule.
ListViewUnitTestingConsiderations
ListViewrulesareusedextensivelyinmostPRPCapplicationsforsection
displaysandreporting.Oftentimes,theoutputfromtheListViewis
functionallycorrect,andwhenruninthedevelopmentenvironment,itrunsin
subsecondresponsetime.
Butwillitcontinuetoperformwellinaproductionenvironment?Dontbe
fooledthisverysimplelistingcouldbecomeaveryseriousproductionissue
laterpotentiallyduetothefollowingfactors:
Testdatareturnedissmall:Theamountofdatareturnedinthetestcaseis
smallerthanwhatwilllikelyoccurinproduction
Tablescontainonlyafewrows:Thesizeoftheunderlyingtablesforyour
testdataismanytimessmallerthantheproductiondatabase,and
inefficientaccessismaskedbytheseverysmalldatasets
Missingindexesnotapparent:Thedatabaseindex(s)necessaryforefficient
queryperformancemaynotexist,butagain,duetothesmalldatasets,we
dontseethenegativeeffectofthatindevelopment.
Unexposeddata:Amoresubtleproblemmaybethatdatabeingreported
onisburieddeepwithinthespecialdatabasecolumnpzPvStream,andthe
resourcesrequiredtoparseoutthedataisextensive.
TroubleshootingListViewReportPerformance
Alwayslooktothebottomoftheruleforanyassociatedwarningmessages.
PRPChasdetectedtwoproperties,CodeandBaseCost,whicharenotexplicitly
definedasdatabasecolumns.
TheListViewreportisrunningadatabasequerytoselectthedesired
information.However,alltheinformationneededinthiscaseisnotstoredin
regulardatabasecolumns.
Whyisthisapotentialproblem?Whenretrievingdata,youmustensurethe
underlyingtableaccessedbytheListViewhascolumnnamesthatexactlymatch
allthereferencedpropertynamesofthisListView.Iftherequestweretorefer
toonlypropertiesthatmaptodatabasecolumn,thenthepzPvStreamwould
notbeneeded.However,onereferencedpropertynotexposedasadatabase
columncancausethegeneratedSelectstatementtoreadthepzPvStream
column.Thisincludesthosepropertiesusedforfilteringandsortingaswell.
YoucanusePRPCsDatabasetoolforviewingandmodifyingyourdatabase
schema.
Creatingdatabasecolumnsforproperties,aprocesscalledexposinga
property,doesnotrequirelongdiscussionswithaDBA;rather,simplygivethe
DBAthegeneratedSQL.
Toretaincertainrowsinthetable,runtheresaverservlettopopulatethe
newlycreatedcolumns.(Seethesystemadministrationguidesfordetails.)
Themoredata,thelongerittakestorunthisresavertool.Exposingthe
requiredpropertiesduringdesigntimecanavoidthisexpensiveoperational
step.
DesignTimeWarningsforJavaActivityMethod
Javacodewarrantsawarningbecausethecodeitselfmaybepoorperforming,
difficulttomaintain,orsimplyusedfordebugging,asitisinthiscase.This
warningpertainstoguardrail#4LimitHandCodedJava.
Oftentimes,programmerswhoareveryfamiliarwithJavatendtoresorttoJava
stepsinsteadofusingthepreferred,andeasiertomaintain,PRPCequivalentof
outoftheboxmethodsthatdothesamething.
Verboseloggingmayseeminnocuous,butitcanhaveanoticeableimpacton
performanceforafewreasons:
Usingprintln()inthiscasesynchronouslyattemptstowritetosysout,which
cancreateabottleneck.
UsingthePRPCoLog()methodisabetterapproachthatusestheLog4J
facilityinstead,whichisasynchronousandmoreefficient.
Also,notehowthestringbeingwrittenismadeupofaconcatenatedsetof
substringsandtokens.ThisprocesscanalsothrowoffgarbageintheJVM
asthestringconcatenationcanbeinefficientfromamemorymanagement
perspective.ThetokengeneratedfromthecalltogetXML()canbequite
largedependingonthesizeofthatobjectandcanalsobememory
intensive.
InsteadofrevertingtoJava,abetterpracticeistousethePRPCOOTB
methodLogMessage,whichaccomplishesthesamegoalwithoutresorting
tomorecomplexJavacodingsyntax.
Asadebuggingaid,unconditionalloggingcanbeuseful,butisnot
productionworthycode.
DesignTimeWarningsforWriteNowandObjSave
PRPCsdefaultbehaviorforperformingObjSaveistodefertheactual
UPDATE/INSERTSQLcommanduntilaCommitisissued.Thebenefitsofthis
deferralaretheabilitytoperformmultiple,backtobacksavesontheverysame
objectinstanceandPRPCwillcombinetheseupdatesintoasinglecumulative
updateatthetimeofcommit.Atthetimeofcommit,alltheINSERTS,
UPDATES,andDELETESarethenissuedatonce.Thismaximizesconcurrency
withintheapplication.
SpecifyingWriteNowdefeatsallthebenefitsofthedeferredsavefeature.
TherearelegitimatereasonstoperformingaWriteNow,suchasneedingto
immediatelyrereadthisinstancebeforeissuingacommit.Useofthismethod
canbedangerousifproperlockinganderrorcheckingisnotdone.Thisisnot
commonpractice,however,whichiswhythesearecalledWarningsandnot
Errors.
UsingtheMyAlertsTooltoUnitTestRule
Performance
WhilePRPCsdesigntimewarningsareverypowerfulandveryinstructive,itis
notpossibletodetectallperformancerelatedissuesbysimplylookingatthe
structureoftherulesandthedatabase.Itisimportanttodetermineiftherules,
whenrun,actuallybehaveasexpected.
PRPChasabuiltinmonitor,calledalerts,thatlookforcertainperformance
relatedbehaviorsofcomponentsandchecksthemagainstpresetthresholdsto
seeiftheyareperformingoutsideofthenorm.
Whenunittestingrules,particularlyactivitiesandflows,checkifanyofthese
alertsarebeinggenerated.
Tocheckforalerts,selecttheMyAlertsselectionfromtheToolsmenu.The
alertsgeneratedforyoursessionwillbelisted.
TheAlertTypecolumnscorrespondtoPegaalertcodes.Forexample,the
BrowserInteractionAlertTypecorrespondstoPegaalertcodePEGA0001.
TheValuecolumnprovidesameasureoftheelapsedtimeinsecondsthat
triggeredthealert.Ifthereareseveralalertsitisbesttofirstfocusonthose
thataremostsevereandmostprevalent.
Thereareover20differenttypesofalerts,withthemostcommonfouralerts
being:
1. DBTime(PEGA0007)
2. BrowerInteraction(PEGA0001)
3. DBBytesRead(PEGA0004)
4. ConnectTotalTime(PEGA0020)
OptimizingQueryPerformancewithDBTimeAlert
DBTime(PEGA0007)istriggeredwhenacalltothePegaRULESdatabase
exceedsacertainthreshold(typically500ms).
Queriesthattakealongtimetorun,especiallyindevelopment,willlikelyrun
evenlongerinaproductionenvironmentwhenhundredsofusersareaccessing
thedatabaseatthesametime.
Therearemanyrootcausesforwhyaquerymighttaketoolongtorun.
Indexingatable:Theremaybeaneedtoaddanindextoatabletomake
thequeryplanmoreefficient
SQLsyntax:ThesyntaxofthegeneratedSQLmaybetoocomplexforthe
DBMStogenerateanefficientqueryaccessplan
Datafiltering:Thefilteringofdatamaynotbefineenoughandyouare
tryingtoreturntoomanyrows
Recordlocking:Theremaybecontentiononthedatabaseserverdueto
recordlocking
Databaseservercapacity:Thecapacityofthedatabaseservermaybe
impactedbyother,unrelatedprocessingsuchasbackups,reports,or
reorganizations
Datareturns:Youarereturningtoomuchdata,suchasverylargeBLOBs,
viathepzPvStreamcolumn
Usethisviewtoseetheexactquerysyntax,aswellasanybindvariablestothe
SQL,anddeterminetheexactdatathisqueryistryingtoretrieve.Whenitis
difficulttodeterminetherootcausevisually:
RerunthisSQLinaninteractivetool,suchasSQL*PLUS,TOAD,DBArtisanor
EnterpriseManager,torecreatetheexecutionevent,or
ProvidethisSQLtoaDBAformoredetailedanalysisofthequeryplan
generated
Toputthisalertintoperspective,theMyAlertstoolprovidestheLastStepand
TraceList,whichlinkstotheexactrulesandsequenceofstepsthatledupto
thisalertevent.Oftentimes,fixingapoorlyrunningqueryisdonebymodifying
therulesthatleduptoandwereusedtogeneratetheSQL.
OptimizingPerformancewithBrowserInteraction
Alert
TheBrowerInteraction(PEGA0001)alertcomparesthePRPCresponsetimefor
thebrowserrequestagainstasystemwidethresholdoftypically1000ms(or1
second).Withthegoalofeachuserinteractionbeingsubsecond,thesealerts
indicateaslowrunningprocessthatneedstobedecomposedtounderstand
whereandhowtoreducetheoverallruntime.
OptimizingPerformancewithDBBytesReadAlert
TheDBBytesRead(PEGA0004)alert(akathebytegovernor)istriggered
wheneveraninteractionwithPRPCcausesmorethan50mbofdata,whichisa
largeamountofdataforasinglerequest,tobereadfromthePegaRULES
database.Typically,thesehappenwhenworkingwithlistsofdataviaListView,
SummaryView,andObjListrules.
Whenthisalertisgenerated,itisessentialtolocatetherulesthatcausethis
muchdatatobereadandlimitthembyaddingmorecriteria,cappingtherows
returned,and/orreducingthenumberofdatacolumnsreturned.Thisalertis
oftentriggeredwhenarulerequiresreadingoftheBLOBorpzPvStream,which
canalsobequitelarge.
Sincethe50mbthresholdishigh,consideraskingthePRPCadministratorto
reducethisthresholdto20mborless.
Also,thereisanoptiontoterminatethePRPCtaskwhenthisthresholdis
encountered.Itishighlyrecommendedthatthisisenabledtoprevent
runaway,unboundedqueriesfromconsumingallavailablememoryand
crashingthesystem.
OptimizingPerformancewithConnectTotalTime
Alert
TheConnectTotalTime(PEGA0020)alertistriggeredwhenaconnectormethod
calltoanexternalsystemexceedsthesystemthresholdof1000ms.Often
times,asinglerequesttoPRPCmayrequiremultiplecallstoconnectorsto
externalsystems,andiftheseperformpoorly,PRPCusersarelikelyto
experiencelongresponsetimes.
Typically,thebottleneckisnotduetoPRPCbuttotheotherapplicationbeing
accessed.Thebottleneckcanoccurifthedatabeingsenttoorreceivedfrom
thisconnectorislargeandcomplex.
Fixingthesealertsoftentimesrequirerestructuringthedesignby:
Fixingthethirdpartyapplicationtoprocesstherequestsmoreefficiently
Reducingthepayloads
Reducingthecomplexityofthedata
Consolidatingsomeoftheconnectorcallstoavoidnetworklatency
Usingmoreefficientconnectortypesoverothersforinstance,MQismore
efficientthanSOAP
Thiscantakequiteabitoftimetoaccomplish,sotheearliertheseissuesare
detectedthebetter.
UncoveringHiddenPerformanceIssueswithPAL
Hiddenperformanceissuesmightincluderuntimesorresourcesusedarenot
highenoughtotriggeranalert,buttheyarestillhighenoughtoindicatethat
moresystemresourcesarebeingusedthanexpected.
WewilladdresstheseissuesusingthePerformanceAnalyzer(PAL).
Beforedoinganything,clicktheResetDatalinktwicetoinitializethePAL
readingstozero.Aftereachscreen,clicktheAddReadinglinktoobtainaDELTA
readingforeach.ThePALreadingsforeachscreenintheflowprovideastory.
Thesummaryviewenablesyoutoquicklyidentifyspotswheresignificant
performancespikesoccurinaprocess.
Note:ResetandredothereadingsifsignificantvaluesfortheRAcolumns
(representingrulesassembly)areshown.Rulesassemblyskewstheresults
significantly,andPALshouldbeanalyzedonlyafterrulesassemblyhasoccurred.
10
Ifrulesassemblypersists,workwiththesystemadministratortodetermineif
thereisaconfigurationissuewithPRPC.
UnderstandingPALIntCountValues
TheIntCountvalueshowshowmanytimesthebrowsercommunicatedwith
thePRPCforthisrequest.Typicalscreenstakefrom13interactions.Complex
screenswithalotofdynamiccontentmayshowthisnumbermuchhigher.The
moreinteractionsperrequest,themoreoverallnetworklatencywillbuildup.
Thisviewshowshowmuchtotaltimeittookscreentoscreenandhowthetime
wasspent(i.e.,whichcategoriesitfallsinto).
UnderstandingthePALCPUTimeValues
CPUtimecanindicateiftheprocessisacomputationallyintensiveone.For
example,ascreenthatused0.18secondsofCPUwouldmeanthatinasingle
userdevelopmentenvironmentthattheTotalElapsedresponsetimewould
besubseconds.However,rememberthisonescreenisusing1/5thofthetotal
CPUonthemachine.Inaproductionsystemthisdoesnotleavemuchcapacity
formorethan4or5moreconcurrentusers.WhencomparingtheTotalCPU
timetotheTotalElapsedtime,thedevelopercanunderstandhowCPUbound
thatrequestwas.IftheTotalElapsedis0.20secondsandTotalCPUis0.18
seconds,thenthatrequestwasalmostallCPU.
CPUnumbersarenotavailableforUNIXbasedsystems,whichiswhyitis
importantfortheinstallationtohaveoneWindowsbasedmachineavailablefor
PALanalysisduringdevelopmentandtesting.
UnderstandingPALRuleCountValues
RuleCountsprovideinsightintothenumberofrulesbeingexecutedbetween
readings.Aretheyinlinewiththenumberofrulesyouhavecodedorarethey
10x,100xormore?VeryhighActivitycountscanbeveryusefulinidentifying
poorperformingloopingconditionsintheprocessorexcessiveprocedural
execution.HighConnectcountsgiveyouanideaastohowchattyyourlogicis
withthebackendsystems.Fiveor10+connectorcallsperrequestcouldaddup
quicklytolongoverallresponsetimes.
UnderstandingPALTotalByteValues
TheTotalBytescounterindicateshowmuchdataismovingbetweentheclient
andtheserver.Thiscounterhelpsdetermineifthereareveryheavyscreensor
iflargeamountsofdataarebeingsenttotheserver.Numbersof100kormore
certainlyareworthlookingintoastheywillsurelystrainthenetworkandthe
browsermachinetoprocessallthatHTMLanddata.
UsingPALtoDetermineClipboardSize
ByclickingtheADDREADINGWITHCLIPBOARDSIZEtoproduceastatisticonthe
detailviewshowinghowbigtheclipboardisasofthisreading.Clipboardsizes
thatexceed10kareanindicationthattheapplicationmayberequestingtoo
muchdataorisnotremovingpagessoonenoughintheprocess.Remember,
memoryisoneofthosepreciousresourcesthatneedstobeusedjudiciously.
TheWITHCLIPBOARDSIZEoptiontakesextraresourcestoproducethese
statistics,soyoushouldnotrelyontheCPUandElapsedTimereadingswhen
usingthisoption.
UnderstandingthePALDetailScreen
ClickthelinkunderoneoftheDELTAreadingsthatrequiresfurther
understanding,possiblyduetoalongTotalElapsedorahighTotalbytes,tosee
over100differentPALstatisticspresented.
Donotbeintimidatedbythelistofnumbers,asthereareafewherethatareof
particularinterest,whiletheothermoreesotericvaluescanberesearchedif
youhappentorequireitatalatertime.
IntheDatabaseAccessCountssection,searchforanythathappentohavethe
termStorageStreaminthelabel.Thesepertaintomeasurementsrelatedto
readingorwritingtheBLOBorpzPvStreamto/fromthedatabase.Thesecanbe
particularlyresourceintensive.Lookingattheexample,notethefollowing
readings:
TheBytesreadfromdatabaseStorageStreamhasover4mb,whichistoo
highandrequiresadjusting.
101rowswerereturnedfromObjListthatrequiredalloftheStorage
Stream,whichindicatesthatanObjListmethodneedstobefixed.
IntheRequestorSummarysection,theNumberofOutputBytessentfrom
theserverasover3MB.Thenextitemdownistherequestorclipboardsize
of3MB.Thisisahugenumberandsignificantlylimitshowmanyconcurrent
userscanbeusingthissysteminproduction.
ScanningoverallthePALdetailedstatistics,anyvaluethatseemstobe
particularlyhighmaybeworthinspectinginmoredetail.
12
UsingAlertandErrorLogstoEnhancePerformance
Beforedecidingthatanapplicationisreadytopromotetothenextlevel,beit
UAT,PreProductionorProduction,checkthePegaRULESAlertlogfileandthe
PegaRULESErrorlogfile.
TheALERTlogfileshouldbeemptyifMyAlertshasbeencheckedalongtheway.
Ifnot,determinewhichALERTSarecontinuingtobepresentedandwhy.
Moreimportantly,checkthePegaerrorlogfilesincemanyerrorscanoccurthat
donotsignificantlyaffecttheuserexperienceatleastthatiswhatitmayseem
whenunittesting.Afailedcalltoaconnector,afailedruleexecution,anull
pointerexception,oramissingorinconsistentrulecanhaveasignificantimpact
onthequalityoftheapplication.
AsidefrombeingaPRPCbestpractice,itisimportanttoensurethereareno
errorsinthelogfilefromaperformanceperspectivebecause:
Loggingtheerrorsandproducingstacktracesisresourceintensive
Itisdifficulttoseeperformancerelatedmessageswhenthelogfileis
riddledwithothererrors
Someerrorsmayhavethesideeffectofslowingdownthesystem
BlobDataRetrievalandPerformanceImplications
ThefullPRPCobjectimageisstoredinthedatabasetablewithinthe
pzPVStreamcolumn,definedasaBLOBdatatype.BLOBsareveryefficientand
flexiblemechanismsforobjectstoragebecause:
TheyarecompressedbyPRPCforlowstorageoverhead.
Theycanholdanyamountofinformationsincetherearenophysicallimit
constraints,suchasmaximumcolumnlengthsorpagesizes.
Theobjectstructurecanbeverycomplex,holdingmanylevelsofnested
structuresandrepeatinggroupsofinformation.
Theobjectstructurecanchangefrominstancetoinstancewithoutthe
involvementoftheDBAinmakingcomplexchangestothedatabase
schema.
Thefollowingisanexampleofwhatoccurswhenrequestinganobjectthat
requiresreadingthestream.
1. TheDBMSexecutesaSelecttoretrievetheobject;atypicalBLOBfora
workobjectis20,000bytesormoreinsize.
2. Duringthisoperation,threeextraI/Ooperationsareperformedtoread
thepzPvStreamasthis20kofdataisstoredin8kchunksontheirowndata
pages.
3. This20kofdataistransmittedasastreamacrossthenetwork.
4. TheJVMallocatesalargechunkofmemorytoreceivethisdata.The
streamisuncompressedusingCPUresourcesandrequiresevenmore
memorytoholdtheuncompresseddata.Thisstreamisparsedtofindthe
dataforthetworeferencedproperties.
5. Thetworequestedclipboardpropertyinstancesarecreated,consuming
moreCPU.
6. Finally,thetemporarymemoryisdiscarded,andtheJVMsooninvokesthe
garbagecollectorandtakesmoreCPUtoreclaimthis40k.
Whenreadingjustoneinstanceofanobject,suchaswhenopeningawork
object,thisoverheadishardlynoticed.WhenusingaListView,thisprocess
happensforeachrowinthelist.ThetypicalcaponListViewreportsis500
rows,whichmeansitiseasytogenerate(500x40,000or20MBofgarbage).
Multiplythisby100usersand2GBofgarbageisgenerated!
Thisisonereasonwhymemoryallocationinproductionsystemsbecomes
excessiveandhowgarbagecollectionwithintheJVMbecomesstrained.High
CPUusageandhighnetworkutilizationalsoaffectuserresponsetime.
Fortunately,byexposingcolumns,thisissuecanbeeasilyremedied.