外文翻译--改进ADO.NET性能.doc
附录1.英文资料ImprovingADO.NETPerformanceImproving.NETApplicationperformanceandscalabilitySummary:Thischapterprovidesprovenstrategiestohelpyoudesignanddevelopscalabledataaccesssolutions.Topicscoveredincludedifferenttechniquestopassdataacrossapplicationlayers,managingthedatabaseconnectionpool,optimizingstoredprocedurecalls,reducingdatasetserializationcost,techniquesforpagingthroughlargeresultsets,managingtransactions,handlingBLOBS,andmuchmore.ObjectivesOptimizeyourdataaccessdesign.ChoosebetweenDataSetsandDataReaders.Runefficientdatabasecommands.Passdatabetweenlayersefficiently.Performefficienttransactions.Optimizeconnectionmanagement.Evaluatethecostofpagingthroughrecords.Evaluatecriteriaforanalyzingdataaccessperformance.Applyperformanceconsiderationstobinarylargeobject(BLOB)manipulation.OverviewWell-designeddataaccesscodeanddataprocessingcommandsareessentialelementsforapplicationperformanceandscalability.Typically,thedatabaseisafocalpointforapplicationloadbecausethemajorityofapplicationrequestsrequiredatathatcomesfromadatabase.Thischapterprovidesprovenstrategiesfordesigningandimplementingdataaccesscodeforperformanceandscalability.HowtoUseThisChapterUsethischaptertoimprovetheimplementationofyourdataaccesscodeforperformanceandscalability.Togetthemostoutofthischapter,considerthefollowing:Jumptotopicsorreadbeginningtoend.Themainheadingsinthischapterhelpyoutoquicklyidentifyandthenlocatethetopicthatinterestsyou.Alternatively,youcanreadthechapterbeginningtoendtogainathoroughappreciationoftheissuesthataffectADO.NETperformance.Usethechecklist.Use"Checklist:ADO.NETPerformance"inthe"Checklists"sectionofthisguidetoquicklyviewandevaluatetheguidelinespresentedinthischapter.Usethe"Architecture"sectionofthischaptertounderstandhowADO.NETworks.Byunderstandingthearchitecture,youcanmakebetterdesignandimplementationchoices.UnderstandcoreADO.NETcomponents,suchasdataproviderobjectsandtheDataSetobject.Usethe"DesignConsiderations"sectionofthischaptertounderstandthehigh-leveldecisionsthatwillaffectimplementationchoicesforADO.NETcode.Measureyourapplicationperformance.learnaboutthekeymetricsthatyoucanusetomeasureapplicationperformance.Youhavetomeasureapplicationperformancesothatyoucanidentifyandresolveperformanceissues.Testyourapplicationperformance."Testing.NETApplicationPerformance"tolearnhowtoapplyperformancetestingtoyourapplication.Youhavetoapplyacoherenttestingprocessandanalyzetheresults.Tuneyourapplicationperformance."Tuning.NETApplicationPerformance"tolearnhowtoresolveperformanceissuesthatyouidentifythroughtheuseoftuningmetrics.TuneSQLServer.ReadChapter14,"ImprovingSQLServerPerformance"toensurethatyourMicrosoft®SQLServerdatabaseisappropriatelyconfigured.ArchitectureADO.NETreliesondataproviderstoprovideaccesstotheunderlyingdatasource.Eachdataproviderexposesasetofobjectsthatyouusetomanageconnections,retrievedata,andupdatedata.Thecoreobjectsarethefollowing:ConnectionCommandDataReaderDataAdapterInaddition,ADO.NETprovidestheDataSetobject,whichprovidesadisconnectedcacheofdata.TheDataSetobjectdoesnotrequireaspecifictypeofdatasourceandisnottiedtotheunderlyingdatasourcethatthedatawasobtainedfrom.ThebasicADO.NETarchitectureisshowninFigure12.1.Figure12.1:ADO.NETarchitectureThefollowinglistoutlinesthepurposeofeachofthemainADO.NETobjects:Connection.Thisobjectrepresentsaconnectiontoadatabase.Command.ThisobjectrepresentsanSQLstatementthatisrunwhileconnectedtoadatasource.ThisobjectcanbeastoredprocedureoradirectSQLstatement.DataReader.Thisobjectretrievesaread-only,forward-onlystreamofdatafromadatabase.TheDataReaderobjectisdesignedforconnectedscenariosandoffersbetterperformancethanreadingdataintoaDataSetobjectattheexpenseoffunctionality.FormoreinformationabouthowtouseDataReaderobjectsandDataSetobjects,see"DataSetvs.DataReader"laterinthischapter.DataAdapter.ThisobjectchannelsdatatoandfromaDataSetobjectandtheunderlyingdatasource.TheDataAdapterobjectalsoprovidesenhancedbatchupdatefeaturesthatwerepreviouslyassociatedwiththeADORecordsetobject.DataSet.TheDataSetobjectrepresentsadisconnected,cachedsetofdata.