JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle GlassFish Server 3.1 Performance Tuning Guide
search filter icon
search icon

Document Information

Preface

1.  Overview of GlassFish Server Performance Tuning

2.  Tuning Your Application

3.  Tuning the GlassFish Server

Using the GlassFish Server Performance Tuner

Deployment Settings

Disable Auto-Deployment

Use Pre-compiled JavaServer Pages

Disable Dynamic Application Reloading

Logger Settings

General Settings

Log Levels

Web Container Settings

Session Properties: Session Timeout

Manager Properties: Reap Interval

Disable Dynamic JSP Reloading

EJB Container Settings

Monitoring the EJB Container

Tuning the EJB Container

Overview of EJB Pooling and Caching

Tuning the EJB Pool

EJB Pool Settings

Tuning the EJB Cache

EJB Cache Settings

Pool and Cache Settings for Individual EJB Components

Commit Option

Determining the Best Commit Option

Java Message Service Settings

Transaction Service Settings

Monitoring the Transaction Service

Viewing Monitoring Information

Tuning the Transaction Service

Disable Distributed Transaction Logging

Recover On Restart (Automatic Recovery)

Keypoint Interval

HTTP Service Settings

Monitoring the HTTP Service

DNS Cache Information (dns)

Enabled

CacheEntries (CurrentCacheEntries / MaxCacheEntries)

HitRatio

Caching DNS Entries

Limit DNS Lookups to Asynchronous

Enabled

NameLookups

AddrLookups

LookupsInProgress

File Cache Information (file-cache)

Keep Alive (keep-alive)

Connection Queue

HTTP Service Access Logging

Network Listener Settings

General Settings

HTTP Settings

Max Connections

DNS Lookup Enabled

Timeout

Header Buffer Length

File Cache Settings

Max File Count

Max Age

Transport Settings

Thread Pool Settings

Max Thread Pool Size

Min Thread Pool Size

ORB Settings

Overview

How a Client Connects to the ORB

Monitoring the ORB

Connection Statistics

Thread Pools

Tuning the ORB

Tunable ORB Parameters

ORB Thread Pool Parameters

Client ORB Properties

Controlling Connections Between Client and Server ORB

Load Balancing

Thread Pool Sizing

Examining IIOP Messages

Resource Settings

JDBC Connection Pool Settings

Monitoring JDBC Connection Pools

Tuning JDBC Connection Pools

Pool Size Settings

Timeout Settings

Isolation Level Settings

Connection Validation Settings

Connector Connection Pool Settings

Transaction Support

Load Balancer Settings

4.  Tuning the Java Runtime System

5.  Tuning the Operating System and Platform

Index

EJB Container Settings

The EJB Container has many settings that affect performance. As with other areas, use monitor the EJB Container to track its execution and performance.

You can configure most EJB container settings from the GlassFish Server Administration Console by navigating to the Configurations->configuration-name->EJB Container node and then following the instructions in the online help.

Monitoring the EJB Container

Monitoring the EJB container is disabled by default. You can enable EJB monitoring through the GlassFish Server Administration Console by navagating to the the Configurations->configuration-name->Monitoring node and then following the instructions in the online help. Set the monitoring level to LOW for to monitor all deployed EJB components, EJB pools, and EJB caches. Set the monitoring level to HIGH to also monitor EJB business methods.

Tuning the EJB Container

The EJB container caches and pools EJB components for better performance. Tuning the cache and pool properties can provide significant performance benefits to the EJB container.

The pool settings are valid for stateless session and entity beans while the cache settings are valid for stateful session and entity beans.

The following topics are addressed here:

Overview of EJB Pooling and Caching

Both stateless session beans and entity beans can be pooled to improve server performance. In addition, both stateful session beans and entity beans can be cached to improve performance.

Table 3-1 Bean Type Pooling or Caching

Bean Type
Pooled
Cached
Stateless Session
Yes
No
Stateful Session
No
Yes
Entity
Yes
Yes

The difference between a pooled bean and a cached bean is that pooled beans are all equivalent and indistinguishable from one another. Cached beans, on the contrary, contain conversational state in the case of stateful session beans, and are associated with a primary key in the case of entity beans. Entity beans are removed from the pool and added to the cache on ejbActivate() and removed from the cache and added to the pool on ejbPassivate(). ejbActivate() is called by the container when a needed entity bean is not in the cache. ejbPassivate() is called by the container when the cache grows beyond its configured limits.


Note - If you develop and deploy your EJB components using Oracle Java Studio, then you need to edit the individual bean descriptor settings for bean pool and bean cache. These settings might not be suitable for production-level deployment.


Tuning the EJB Pool

A bean in the pool represents the pooled state in the EJB lifecycle. This means that the bean does not have an identity. The advantage of having beans in the pool is that the time to create a bean can be saved for a request. The container has mechanisms that create pool objects in the background, to save the time of bean creation on the request path.

Stateless session beans and entity beans use the EJB pool. Keeping in mind how you use stateless session beans and the amount of traffic your server handles, tune the pool size to prevent excessive creation and deletion of beans.

EJB Pool Settings

An individual EJB component can specify cache settings that override those of the EJB container in the <bean-pool> element of the EJB component’s sun-ejb-jar.xml deployment descriptor.

The EJB pool settings are:

Tuning the EJB Cache

A bean in the cache represents the ready state in the EJB lifecycle. This means that the bean has an identity (for example, a primary key or session ID) associated with it.

Beans moving out of the cache have to be passivated or destroyed according to the EJB lifecycle. Once passivated, a bean has to be activated to come back into the cache. Entity beans are generally stored in databases and use some form of query language semantics to load and store data. Session beans have to be serialized when storing them upon passivation onto the disk or a database; and similarly have to be deserialized upon activation.

Any incoming request using these “ready” beans from the cache avoids the overhead of creation, setting identity, and potentially activation. So, theoretically, it is good to cache as many beans as possible. However, there are drawbacks to caching:

Keeping in mind how your application uses stateful session beans and entity beans, and the amount of traffic your server handles, tune the EJB cache size and timeout settings to minimize the number of activations and passivations.

EJB Cache Settings

An individual EJB component can specify cache settings that override those of the EJB container in the <bean-cache> element of the EJB component’s sun-ejb-jar.xml deployment descriptor.

The EJB cache settings are:

Pool and Cache Settings for Individual EJB Components

Individual EJB pool and cache settings in the sun-ejb-jar.xml deployment descriptor override those of the EJB container. The following table lists the cache and pool settings for each type of EJB component.

Table 3-2 EJB Cache and Pool Settings

Bean
Cache Settings
Pool Settings
Type of Bean
cache-resize-quantity
max- cache-size
cache-idle-timeout-in-seconds
removal- timeout- in- seconds
victim-selection- policy
refresh-period-in-seconds
steady-pool-size
pool-resize-quantity
max-pool-size
pool-idle-timeout-in- seconds
Stateful Session
X
X
X
X
X
Stateless Session
X
X
X
X
Entity
X
X
X
X
X
X
X
X
X
Entity Read-only
X
X
X
X
X
X
X
X
X
X
Message Driven Bean
X
X
X

Commit Option

The commit option controls the action taken by the EJB container when an EJB component completes a transaction. The commit option has a significant impact on performance.

The following are the possible values for the commit option:

Option B avoids ejbAcivate() and ejbPassivate() calls. So, in most cases it performs better than option C since it avoids some overhead in acquiring and releasing objects back to pool.

However, there are some cases where option C can provide better performance. If the beans in the cache are rarely reused and if beans are constantly added to the cache, then it makes no sense to cache beans. With option C is used, the container puts beans back into the pool (instead of caching them) after method invocation or on transaction completion. This option reuses instances better and reduces the number of live objects in the JVM, speeding garbage collection.

Determining the Best Commit Option

To determine whether to use commit option B or commit option C, first take a look at the cache-hits value using the monitoring command for the bean. If the cache hits are much higher than cache misses, then option B is an appropriate choice. You might still have to change the max-cache-size and cache-resize-quantity to get the best result.

If the cache hits are too low and cache misses are very high, then the application is not reusing the bean instances and hence increasing the cache size (using max-cache-size) will not help (assuming that the access pattern remains the same). In this case you might use commit option C. If there is no great difference between cache-hits and cache-misses then tune max-cache-size, and probably cache-idle-timeout-in-seconds.