Professional Documents
Culture Documents
Architecture Design - Very Useful Tips
Architecture Design - Very Useful Tips
htm
Balancing Network Load with Priority Queues (Page last updated December
2001, Added 2002-02-22, Author Frank Fabian). Tips:
• Sort incoming requests into different priority queues, and service the
requests according to the priorities assigned to each queue. [Article gives
the example where combining user and automatic requests in one queue
can result in a worst case user wait of 3.5 minutes, as opposed to less
than 0.1 seconds if priority queues are used].
http://developer.java.sun.com/developer/technicalArticles/ebeans/ejbperformanc
e/
Designing Entity Beans for Improved Performance (Page last updated March
2001, Added 2001-03-21, Author Beth Stearns). Tips:
• Use a value object which encapsulates all of an entity's data attributes,
and which transfers all the data in one network transfer. This may result in
large objects being transferred though.
http://www.bastie.de/resource/res/mjp.pdf and
http://www.bastie.de/java/mjperformance/contents.html
Performance tuning report in German. Thanks to Peter Kofler for extracting
the tips. (Page last updated November 2001, Added 2001-07-20, Author
Sebastian Ritter). Tips:
• use the flyweight pattern to reduce object creation [The flyweight pattern
uses a factory instead of 'new' to reuse objects rather than always create
new ones].
http://java.sun.com/blueprints/patterns/j2ee_patterns/catalog.html
Design patterns catalog (Page last updated 2001, Added 2002-01-25,
Author ?). Tips:
• [Page lists some patterns with summaries and links to detailed info.
Patterns are: Data Access Object; Fast-Lane Reader; Front Controller;
Page-by-Page Iterator; Session Facade; Value Object].
• Use the Data Access Object pattern to decouple business logic from data
access logic, allowing for optimizations to be made in how data is
managed.
• Use Data Access Objects to decouple the business logic from the data
access logic, allowing data access optimizations to be decoupled from
other types of optimizations.
http://www.onjava.com/pub/a/onjava/2002/01/16/patterns.html
J2EE Design Patterns for the presentation tier (Page last updated January
2002, Added 2002-01-25, Author Sue Spielman). Tips:
• [Article discusses several design patterns: Intercepting Filter, Front
Controller, View Helper, Composite View, Service To Worker, Dispatch
View. Performance is not explicitly covered, but at least a couple are
relevant to getting good performance].
http://www.sys-con.com/java/article.cfm?id=1149
Performance tuning (Page last updated September 2001, Added 2001-10-22,
Author James McGovern). Tips:
• Use the factory pattern to enable reuse or cloning of objects.
http://www.ddj.com/documents/ddj0204a/
Alternatives to using 'new'. (Page last updated March 2002, Added 2002-03-
25, Author Jonathan Amsterdam). Tips:
• The Singleton pattern and the Flyweight (object factory) pattern are useful
to limit numbers of objects of various types and to assist with object reuse
and reduce garbage collection.
• The Abstract Factory design pattern uses a single class to create more
than one kind of object.
• Where long lists of data are returned by queries, use the Page-by-Page
Iterator pattern: a server-side object that holds data on the server and
supplies batches of results to the client.
http://developer.java.sun.com/developer/technicalArticles/J2EE/J2EEpatterns/
Performance optimizing design patterns for J2EE (Page last updated
December 2001, Added 2001-12-26, Author Vijay Ramachandran). Tips:
• For read-only access to a set of data that does not change rapidly, use the
Fast Lane Reader pattern which bypasses the EJBs and uses a (possibly
non-transactional) data access object which encapsulates access to the
data. Use the Fast Lane Reader to read data from the server and display
all of them in one shot.
• When you need to access a large remote list of objects, use the Page-by-
Page Iterator pattern which sends smaller subsets of the data as
requested until the client no longer want any more data. Use the Page-by-
Page Iterator to send lists of simple objects from EJBs to clients.
• When the client would request many small data items which would require
many remote calls to satisfy, combine the multiple calls into one call which
results in a single Value Object which holds all the data required to be
transferred. Use the Value Object to send a single coarse-grained object
from the server to the client(s).
http://www.javaworld.com/javaworld/javatips/jw-javatip78.html
Article on recycling resource pools (Page last updated 1998, Added 2000-12-
20, Authors Philip Bishop and Nigel Warren). Tips:
• Use the builder pattern: break the construction of complex objects into a
series simpler Builder objects, and a Director object which combines the
Builders to form the complex object. Then you can use Recycler (a type of
Director) to replace only the broken parts of the complex object, so
reducing the amount of objects that need to be recreated.
http://www.precisejava.com/javaperf/j2ee/EJB.htm
EJB performance tips (Page last updated November 2001, Added 2001-12-26,
Authors Ravi Kalidindi and Rohini Datla). Tips:
• Wrap multiple entity beans in a session bean to change multiple EJB
remote calls into one session bean remote call and several local calls
(pattern called SessionFacade).
• Change multiple remote method calls into one remote method call with all
the data combined into a parameter object.
• The Value Object Assembler pattern uses a Session EJB to aggregate all
required data as various types of ValueObjects. This pattern is used to
satisfy one or more queries a client might need to execute in order to
display multiple data types.
http://www7b.boulder.ibm.com/wsdd/library/techarticles/0106_brown/sessionfac
ades.html
Rules and Patterns for Session Facades (Page last updated June 2001, Added
2001-07-20, Author Kyle Brown). Tips:
• Use the Facade pattern, and specifically Value objects, to transfer all the
subset of data needed from an entity bean in one transfer.
http://www.sys-con.com/java/article.cfm?id=1160
Local entity beans (Page last updated October 2001, Added 2001-10-22,
Author Alex Pestrikov). Tips:
• Facade objects (wrappers) allow local entity beans to be called remotely.
This pattern incurs very little overhead for remote calls, while at the same
time optimizing local calls between local beans which can use local calls.
http://www.sys-con.com/java/article.cfm?id=712
J2EE challenges (Page last updated June 2001, Added 2001-07-20, Author
Chris Kampmeier). Tips:
• To ensure good performance use experienced J2EE builders and use
proven design patterns.
http://www.javaworld.com/javaworld/jw-07-2001/jw-0713-optimism.html
The Optimistic Locking pattern (Page last updated July 2001, Added 2001-07-
20, Author Yasmin Akbar-Husain and Eoin Lane). Tips:
• Optimistic locking only checks data integrity at update time, so has no lock
contention [but can have high rollback costs]. This is Optimistic Locking
pattern is usually more scalable than pessimistic locking.
• Don't transfer long lists of data to the user, transfer a page at a time (this
is called the Page-by-Page Iterator pattern).
• The Proxy pattern often instantiates its real object, the Decorator pattern
(which can also use proxy objects) rarely does.