Labels

Monday, June 4, 2012

Tips for GlassFish Performance in a Production Environment

Tip 1: Java Version
Obious .. change to latest JVM if possible.

Tip 2: JVM Mode
GF runs with -client ootb. change to -server

Tip 3: Java Heap Size
Give your server, hat it needs.
By default, the GlassFish application server is set to 512 MB
and the limit for a 32 bit JVM version- is approximately 3.5GB on Solaris, and 1.5
GB on Windows without any operating system tweaks.

Tip 4: Tune Java Garbage Collection
A deeper understanding is necessary when tinkering with GC tuning options and it is strongly recommended

Tip 5: HTTP acceptor threads
HTTP acceptor threads accept new incoming connections and schedule new
requests for the existing connections. The default number of acceptor threads is one! It is recommended to have 1 thread per 1-4 core.

Tip 6: HTTP request processing threads
This pool of threads retrieve and process incoming HTTP requests. The default
number of request processing threads is 5 but a starting rule of thumb is to tune
the number of HTTP request processing threads to the number of CPUs.

Tip 7: Optimize Keep Alive subsystem
This subsystem prevents the server from being overloaded with connections. A
waiting keep alive connection has completed processing the previous request,
and is waiting for a new request to arrive on the same connection.
Three factors describe the Keep-Alive behavior. Keep-Alive timeout, Keep-Alive max connections and thread-count. Performance tuning in this subsystem highly depends on your applications needs.

Tip 8: Optimize static content delivery
If your application contains static files, it is recommended to enable HTTP file
cache to optimize performance. This should not be relevant for clusters running httpd with mod_proxy or similar in front.

Tip 9: Use default-web.xml to disable dev features
The default-web.xml file defines features such as filters and security constraints
that apply to all web applications. You should use it, to define some common constraints that are performance critic to all deployed applications. Most common two are this:

<init-param>
<param-name>development</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>genStrAsCharArray</param-name>
<param-value>true</param-value>
</init-param>

Tip 10: JDBC Tuning
Tune the steady-pool-size and the max-pool-size, and set them to the same
value. This will avoid unnecessary resizing of the pool. A general
rule of thumb is to tune the value for max-pool-size and steady-pool-size to the
same number of HTTP request processing threads.

No comments:

Post a Comment