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

Manager Properties: Reap Interval
Modifying the reap interval can improve performance, but setting it without considering the
nature of your sessions and business logic can cause data inconsistency, especially for
time-based persistence-frequency.
For example, if you set the reap interval to 60 seconds, the value of session data will be recorded
every 60 seconds. But if a client accesses a servlet to update a value at 20 second increments,
then inconsistencies will result.
For example, consider an online auction scenario as follows:
■
Bidding starts at $5, in 60 seconds the value recorded will be $8 (three 20 second intervals).
■
During the next 40 seconds, the client starts incrementing the price. The value the client sees
is $10.
■
During the client’s 20 second rest, the Application Server stops and starts in 10 seconds. As a
result, the latest value recorded at the 60 second interval ($8) is be loaded into the session.
■
The client clicks again expecting to see $11; but instead sees is $9, which is incorrect.
■
So, to avoid data inconsistencies, take into the account the expected behavior of the
application when adjusting the reap interval.
Disable Dynamic JSP Reloading
On a production system, improve web container performance by disabling dynamic JSP
reloading. To do so, edit the default-web.xml le in the config directory for each instance.
Change the servlet denition for a JSP le to look like this:
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>development</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>genStrAsCharArray</param-name>
<param-value>true</param-value>
</init-param> <load-on-startup>3</load-on-startup>
</servlet>
Web Container Settings
Sun GlassFish Enterprise Server 2.1 Performance Tuning Guide • January 200952










