Slides - NTU

clumpsmackoverΛογισμικό & κατασκευή λογ/κού

2 Δεκ 2013 (πριν από 3 χρόνια και 8 μήνες)

111 εμφανίσεις

SE 767
-
NT

Software Performance Engineering


Robert Oshana









Lecture #
23












For more information, please contact:





NTU Tape Orders:






NTU Media Services: (970) 495
-
6455


tapeorders@ntu.edu

oshana@airmail.net

Implementation solutions

Chapter 12

Time versus space tradeoffs


Caching rule; store data that is
accessed most often to make it
cheapest to access


Other strategies


Move each item found in a list closer to
the beginning


Caching timestamp of HTTP request


Caching most commonly used windows


Caching results of remote comm,
queries, objects

Some other rules


Postpone evaluation until an item is
needed


Augment data structures with extra
information, or change the structure
so that it can be accessed more
easily


Make fewer calls and process
multiple requests with each call

Trading time for space


Use dense storage representations
to decrease storage cost by
increasing the time required to store
and retrieve data


Represent common sequences of
operations compactly and interpret
as required

Size / Performance Tradeoff

Performance solutions for
object
-
oriented software

Language independent
solutions


Reduce unnecessary object creation
and destruction


Heap more expensive than stack

String s1, s2, s3, myString;

….

myString = s1 + s2 + s3;

….

String s1, s2, s3, myString;

….

myString = s1;

myString = s1 += s2;

myString += s3;

….

Language independent
solutions


Reduce method invocation overhead


Encapsulation often introduces
additional procedure calls


Amount of work required depends on
HW/SW platform


Try inlining the called method

int Point::getX( )

{



return x;

}

C++ solutions


Inline to reduce method invocation
overhead


Keyword “inline”


Hint to compiler


may ignore


Can significantly reduce overhead


More efficient multithreading


Must use thread library (POSIX)


Use standard library calls

Java solutions


Inline to reduce method invocation
overhead


“optimize” option in compiler


Declare “final”, “static”, or “private”


Reduce garbage collection overhead


No memory leak problems in Java!


Garbage collection is low priority thread


Not deterministic

Java solutions


Optimize serialization


Encoding of objects as a stream of
bytes


“serializable” interface (expensive)


Use “transient” keyword where possible


“externalizable” (extends serializable)

Java solutions


More efficient multithreading


Can improve responsiveness and
scalability


Frequent creation and destruction of
threads is costly


Use “synchronized” for shared data


Hotspot compiler to improve
performance

Code Optimization Process

write c code

compile

measure

efficiency

efficient


?

done

yes

no

redefine c code

compile

measure

efficiency

efficient


?

yes

no

write assembly

measure

efficiency

efficient


?

yes

no

Summary


Implementation decisions and
coding choices address the “last
mile”


Performance tuning conducted late
or post development


Several generic solutions available


Specific solutions available

Web Applications

Chapter 13

Where we are


Introduction


SPE Quick View


SPE and the UML


Software Execution Models


Web applications and other distributed systems


System execution models


SPE data collection


Software measurement and instrumentation


Performance oriented design


Performance patterns


Performance anti
-
patterns


Implementation solutions


Web applications


Embedded and real
-
time systems


The SPE process


Implementing SPE

Introduction


Web app is similar to a C/S app
deployed using a web site


Static and dynamic content


Use of a browser


Complex environments

Web application

Performance issues


Responsiveness


time to retrieve and display a web page


End to end time for a business process


User perceived responsiveness can be
improved using good design


Scalability



Ability to handle more and more users
to a site

Performance issues


Decisions about amount of data sent
over the network


Number of interactions to complete a
task


Integration of legacy applications

Performance issues


How much of the app will execute on
the server?


What will execute on the client?


Should component libraries be
used?


How to access DBs

SPE models for Web Apps


Similar to those for distributed
systems


All starts with use cases


Identify processing steps with
greatest impact


Create SW execution model

Web application model

SE 767
-
NT

Software Performance Engineering


Robert Oshana









End of lecture












For more information, please contact:





NTU Tape Orders:






NTU Media Services: (970) 495
-
6455


tapeorders@ntu.edu

oshana@airmail.net