Tải bản đầy đủ

Addison wesley java performance and scalability volume 1 server side programming techniques jun 2000 ISBN 0201704293



TableofContents

Java™PerformanceandScalabilityVolume1:
Server-SideProgrammingTechniques
ByDovBulka

Publisher

:AddisonWesley

PubDate

:June05,2000

ISBN

:0-201-70429-3

Pages


:320

Thisbookwaswrittenwithonegoalinmind:toprovideJava
programmerswiththeexpertiseneededtobuildefficient,scalableJava
code.Theauthorshareshisexperienceinserver-sideperformance
tuningthroughmeasuredperformanceassessments,called
optimizations.Eachoptimizationdiscussestechniquestoimprovethe
performanceandscalabilityofyourcode.Everyclaimissubstantiated
withhardnumbersandanexperience-basedevaluation.Java(TM)
PerformanceandScalability,Volume1,providesinvaluableadvicethat
youwill,nodoubt,findusefulinyourcoding.
Presentedin48conciselessonsthattargetthemostcommonandcritical
performancepitfalls,thisbookoffersaplethoraofpracticaltipsand
solutionsforboostingtheperformanceofyourprograms.Theselessons
coverperformance-criticalareassuchasmemorymanagement,garbage
collection,caching,andmultithreading.


Specificlessonsinclude:


ReservingStringBuffercapacity


Avoidingprematureobjectcreation


Creatinganefficientvectorclass


DesigningcachingintoyourAPI


Thecostofsynchronization


Parallelsubtasks


JNIefficiency
VaryingtheserverworkloadandRMInetworkplumbing


UsingServletOutputStream
CachingJDBC(TM)connections
Inadditiontoprovidinghardnumbersthatquantifytheoptimizations,the
authorconcludesthebookwithanapplicationdemonstratingthe
effectivenessoftheperformanceoptimizations.Theexercisetakesa
typicalprogramandincreasesitsperformancefourfoldthroughaseries
ofstepsthattietogetherthelessonslearnedthroughoutthebook.He
offersboththemeansandtheprooftobettercoding.






TableofContents

Java™PerformanceandScalabilityVolume1:
Server-SideProgrammingTechniques
By
DovBulka

Publisher

:AddisonWesley

PubDate

:June05,2000

ISBN

:0-201-70429-3

Pages

:320

Copyright
ListofFigures
Chapter1
Chapter2
Chapter3
Chapter5
Chapter6
Chapter7
Chapter8
Chapter9
Chapter10
Chapter11
Preface
Introduction


JavaSpeed
TheTestEnvironment
BeforeYouOptimize:AWordofCaution
OrganizationofThisBook
Acknowledgments
Chapter1.
JavaStrings
Optimization1:StringConcatenation
Optimization2:FightObjectOverpopulation
Optimization3:StringEquality
Optimization4:CharacterstoBytesandBack
Optimization5:StringTokenizer
Optimization6:charAt()
Optimization7:PrefercharAt()tostartsWith()
Optimization8:ReserveStringBufferCapacity
KeyPoints
Chapter2.
PureOverhead
Optimization9:UselessComputations
Optimization10:Don'tTraceTrivialMethods
Optimization11:MakingOverheadVanish
Optimization12:PrematureObjectCreation
Optimization13:Don'tInitializeTwice
Optimization14:DoYouReallyNeedtoZero-OutaBuffer?
Optimization15:The80–20Principle
Optimization16:PurgeObsoleteCode
KeyPoints
Chapter3.

VectorsandHashtables
Optimization17:VectorAddandRemove
Optimization18:VectorCapacity
Optimization19:VectorEnumeration
Optimization20:EfficientVectorClass
Optimization21:UsingtheAPIWisely
Optimization22:HashtableParameters
Optimization23:SpeedUphashCode()
Optimization24:SpeedUpequals()
KeyPoints
Chapter4.
Caching
Optimization25:CacheFileContents
Optimization26:DesignCachingintoYourAPI


Optimization27:Precompute
Optimization28:RelaxGranularity
Optimization29:Inheritance
KeyPoints
Chapter5.
I/OStreams
ExampleI/OCode
Optimization30:OutputBuffering
Optimization31:Don'tFlushPrematurely
Optimization32:PreferByteStreamtoUnicode
Optimization33:InputBuffering
Optimization34:Byte-to-CharConversions
Optimization35:BinaryI/O
KeyPoints
Chapter6.
Recycling
Optimization36:ObjectRecycling
Optimization37:ObjectPools
Optimization38:LastIn,FirstOut
KeyPoints
Chapter7.
ScalabilityandMultithreading
ScalabilityBasics
TheSMPArchitecture
Amdahl'sLaw
MultithreadedandSynchronizationTerminology
TheCostofSynchronization
Optimization39:ParallelSubtasks
Optimization40:SynchronizationFalseSharing
Optimization41:LockFusion
Optimization42:CodeMotion
Optimization43:ShareNothing
Optimization44:PartialSharing
Optimization45:Read/WriteLocks
KeyPoints
Chapter8.
JNI
Optimization46:JNISurprise
Optimization47:JNItotheRescue
Optimization48:PreferSystem.arraycopy()
KeyPoints


Chapter9.
RMI
TheRMINetworkPlumbing
VaryingtheServerWorkload
RMIServeronRemoteMachine
SerializingHeavyweightObjects
KeyPoints
Chapter10.
Servlets
ServletsUsingPrintWriter
ServletsUsingServletOutputStream
PrecomputingMessageBytes
PumpingMoreData

PingServlet—APerformanceUpperBound
ExtendingPingServlet
SessionState

PingJdbc
CachingJDBCConnections
JSP—JavaServerPages
RMI
KeyPoints
Chapter11.
AJavaWebServer
Version1:TheOriginalServer
Version2
Version3
Version4
Version5
Version6
KeyPoint
AppendixA.
CachingJDBCConnections

CacheDriver.java
CacheConnection.java
CacheStatement.java
CacheCallableStatement.java
CachePreparedStatement.java
CacheDriver.properties
AppendixB.
SimpleJavaWebServer

Server.java


FileInfo.java
UrlCache.java
LazyDate.java
MyGetBytes.java
server.properties
Bibliography







Copyright
Manyofthedesignationsusedbymanufacturersandsellerstodistinguishtheirproductsareclaimedas
trademarks.Wherethosedesignationsappearinthisbookandwewereawareofatrademarkclaim,
thedesignationshavebeenprintedininitialcapitallettersorallcapitals.
Theauthorsandpublisherhavetakencareinthepreparationofthisbook,butmakenoexpressedor
impliedwarrantyofanykindandassumenoresponsibilityforerrorsoromissions.Noliabilityis
assumedforincidentalorconsequentialdamagesinconnectionwithorarisingoutoftheuseofthe
informationorprogramscontainedherein.
Copyright©2000byIBMCorporationAllrightsreserved.Nopartofthispublicationmaybereproduced,
storedinaretrievalsystem,ortransmitted,inanyformorbyanymeans,electronic,mechanical,
photocopying,recording,orotherwise,withoutthepriorconsentofthepublisher.PrintedintheUnited
StatesofAmerica.PublishedsimultaneouslyinCanada.
Thepublisheroffersdiscountsonthisbookwhenorderedinquantityforspecialsales.Formore
information,pleasecontact:PearsonEducationCorporateSalesDivisionOneLakeStreet
UpperSaddleRiver,NJ07458
(800)382-3419
corpsales@pearsontechgroup.com
VisitusontheWebatwww.awl.com/cseng/
LibraryofCongressCataloging-in-PublicationDataBulka,Dov.
Javaperformanceandscalability/DovBulka.
p.cm.
Includesbibliographicalreferencesandindex.
Contents:v.1.Server-sidetechniquesISBN0-201-70429-3
1.Java(Computerprogramlanguage)I.Title.
QA76.73.J38B842000
005.13'3—dc2100-025661
Textprintedonrecycledpaper.
12345678910-ML-0403020100
Firstprinting,May2000

Dedication
Tomysisters,MiriAmirandDvoraSarig,mybrother,ZeevBulka,andlastbutnotleast,mywife,
CynthiaPowersBulka.








ListofFigures
Chapter1
Chapter2
Chapter3
Chapter5
Chapter6
Chapter7
Chapter8
Chapter9
Chapter10
Chapter11





Chapter1
Figure1.1ComparingStringandStringBufferappendsFigure1.2CompareString
toStringBufferperformanceFigure1.3Overabundanceofobjectstakesatollon
performanceFigure1.4YoucoulddoworsethanString+
Figure1.5toUpperCase()createsanewStringobjectFigure1.6Performanceof
StringequalitytestsFigure1.7ThevariousflavorsofStringequalityFigure1.8Comparing
String.getBytes()toahomegrownoneFigure1.9Thefastbyte-to-charconverterhas
beendeprecatedFigure1.10AStringTokenizercomparedtoahomegrownoneFigure
1.11Homegrowntokenizingisfaster
Figure1.12AfastercharAt()
Figure1.13ArraycopyplusdirectindexingoutperformedcharAt()
Figure1.14FasteralternativesforstartsWith()





Chapter2
Figure2.1Tracingimpactonperformance
Figure2.2Theimpactofdoubleinitialization





Chapter3
Figure3.1VectorinsertionFigure3.2Performanceandcapacity
Figure3.3PerformanceofVectoriterationsFigure3.4PvectorisfasterthanVector
Figure3.5TwowaystopopanelementFigure3.6Thecostofobjectcreationcompeteswith
hashCode()gainsFigure3.7RecyclingtheStringWrapperprovidesaperformance
boostFigure3.8ThecostofString.toUppercase()wasoverwhelming





Chapter5
Figure5.1Thebufferingimpact
Figure5.2Periodicflush()callswillhurtFigure5.3TheautoFlushfeatureisakiller
Figure5.4AnoutputstreamisfasterthanawriterFigure5.5Inputbufferingishighly
recommendedFigure5.6AnInputStreamisfasterthanaReader
Figure5.7ThecostofTrade.toString()
Figure5.8TransformationstoandfromUnicodeareexpensiveFigure5.9Deserializingisfaster
thanUnicodetransformations





Chapter6
Figure6.1RecyclingaVectorwasfasterthancreatinganewone
Figure6.2Poolingisunderstandablyslowerthanrecycling




Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay

×

×