Sun Microsystems 820434310 Server User Manual


 
Tuning Your Application
This chapter provides information on tuning applications for maximum performance. A
complete guide to writing high performance Java and Java EE applications is beyond the scope
of this document.
This chapter discusses the following topics:
“Java Programming Guidelines” on page 27
“Java Server Page and Servlet Tuning” on page 29
“EJB Performance Tuning” on page 32
Java Programming Guidelines
This section covers issues related to Java coding and performance. The guidelines outlined are
not specic to Enterprise Server, but are general rules that are useful in many situations. For a
complete discussion of Java coding best practices, see the
Java Blueprints.
Avoid Serialization and Deserialization
Serialization and deserialization of objects is a CPU-intensive procedure and is likely to slow
down your application. Use the transient keyword to reduce the amount of data serialized.
Additionally, customized readObject() and writeObject() methods may be benecial in
some cases.
Use StringBuer to Concatenate Strings
To improve performance, instead of using string concatenation, use StringBuffer.append().
String objects are immutable—they never change after creation. For example, consider the
following code:
2
CHAPTER 2
27