Server User Manual
Table Of Contents
- Sun GlassFish Enterprise Server 2.1 Performance Tuning Guide
- Preface
- Overview of Enterprise Server Performance Tuning
- Tuning Your Application
- Java Programming Guidelines
- Java Server Page and Servlet Tuning
- EJB Performance Tuning
- Goals
- Monitoring EJB Components
- General Guidelines
- Using Local and Remote Interfaces
- Improving Performance of EJB Transactions
- Use Container-Managed Transactions
- Don’t Encompass User Input Time
- Identify Non-Transactional Methods
- Use TX_REQUIRED for Long Transaction Chains
- Use Lowest Cost Database Locking
- Use XA-Capable Data Sources Only When Needed
- Configure JDBC Resources as One-Phase Commit Resources
- Use the Least Expensive Transaction Attribute
- Using Special Techniques
- Tuning Tips for Specific Types of EJB Components
- JDBC and Database Access
- Tuning Message-Driven Beans
- Tuning the Enterprise Server
- Deployment Settings
- Logger Settings
- Web Container Settings
- EJB Container Settings
- Java Message Service Settings
- Transaction Service Settings
- HTTP Service Settings
- ORB Settings
- Thread Pool Settings
- Resources
- Tuning the Java Runtime System
- Tuning the Operating System and Platform
- Tuning for High-Availability
- Index

TuningYour 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 specic 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 benecial in
some cases.
Use StringBuer 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










