16 Tuning Oracle Certified Application Server to Enhance Convergence Performance

Oracle Communications Convergence is a Java application bundled into a WAR file that runs inside the Oracle certified application server web container. This chapter describes how to optimize the Oracle certified application server environment to allow Convergence to deliver the best possible performance.

For general GlassFish Server performance tuning, see GlassFish Server Performance Tuning Guide.

For general Oracle WebLogic Server performance tuning, see Oracle Fusion Middleware Tuning Performance of Oracle WebLogic Server Guide.

Convergence Performance Tuning Overview

Advances in storage, servers, and Java affect how one tunes web containers for middleware. There are systems with multi-threaded chips having 32 effective processors, operating systems with virtualized containers like Solaris zones, and file systems like ZFS that can spread files out over many disks. Java can automatically adjust itself based on dynamic conditions. The tuning options available are many, and you must choose what works for you.

The tuning guidance presented here offers options to examine and configure. However, these options do not address specific hardware configurations and are not guaranteed to improve performance for any particular hardware configuration, performance load, or type of load on your system.

Try out the options and tips that apply to your deployment, test their impact on performance, and tweak the option values as needed.

For GlassFish Server:

Use GlassFish Server's administration browser interface or command-line interface rather than directly editing the domain.xml file to make changes. The changes do not take effect until the domain instance is restarted.

Modify GlassFish server domain/config/port in which Convergence is running.

For Oracle WebLogic Server:

Use Oracle WebLogic Server's administration browser interface or command-line interface rather than directly editing the config.xml file to make changes. The changes do not take effect until the domain instance is restarted. You should restart the Admin Server and Managed Server on which Convergence is deployed.

On Oracle WebLogic Server Administration console, modify the configuration parameters for WebLogic Managed Server on which Convergence is deployed.

Tuning GlassFish Server Configuration Parameters

Table 16-1 lists the tested tuning parameters for GlassFish Server for Convergence. These tested parameters were set assuming 10,000 users with a deployment that included mail, calendar, and address book services. There are differences between tuning Convergence with IM enabled and with IM disabled.

Table 16-1 GlassFish Server Tuning Parameters

Parameter Value (if IM Disabled) Value (if IM Enabled)

server-config.network-config.protocols.protocol.http-listener-1.http.header-buffer-length-bytes

default

16384

server-config.network-config.protocols.protocol.http-listener-1.http.timeout-seconds

16

20

server-config.network-config.protocols.protocol.http-listener-1.http.file-cache.enabled

default

true

server-config.network-config.transports.transport.tcp.acceptor-threads

32 (64 core system)

-1

server-config.network-config.transports.transport.tcp.idle-key-timeout-seconds

default

300

server-config.thread-pools.thread-pool.http-thread-pool.min-thread-pool-size

32

8

server-config.thread-pools.thread-pool.http-thread-pool.max-thread-pool-size

256

512


Tip:

For the request threads run HTTP requests, you want just enough: enough to keep the machine busy, but not so many that they compete for CPU resources – if they compete for CPU resources, then your throughput will suffer greatly. Too many request processing threads is often a big performance problem.

Determining how much is just enough depends – in a case where HTTP requests don't use any external resource and are hence CPU bound, you want only as many HTTP request processing threads as you have CPUs on the machine. But if the HTTP request makes a database call (even indirectly, like by using a JPA entity), the request will block while waiting for the database, and you could profitably run another thread. So this takes some trial and error, but start with the same number of threads as you have CPU and increase them until you no longer see an improvement in throughput.

Since Convergence communicates extensively with back-end messaging and calendar resources, request blocking could be an issue. You will need to monitor your own deployment and adjust the Thread Count accordingly.

Tuning Parameters for the HTTP Listener

To configure this setting, select Acceptor Threads from the Configurations menu (Configurations/server-config/Network Config/Transports/tcp/Acceptor Threads) in the GlassFish Server Administration Console. Using asadmin, change server-config.network-config.transports.transport.tcp.acceptor-thread parameter.

Increase the HTTP listener acceptor-threads. The default value is: acceptor-threads="1".

In the HTTP Service section of the GlassFish Server Administration Console, on the listener for the port for Convergence (such as 8080):

Start with a value of 2 and monitor the performance.

To configure this setting, select the Listener1* from the Configuration menu (Configuration/HTTP Services/HTTP Listeners/) in the GlassFish Server Administration Console:

(http-listener-1 is assumed to be in use for Convergence.)

Take these steps:

  • Increase the acceptor-threads value to the number of CPUs on the system.

  • If you have only one interface (NIC), change the default 0.0.0.0 IP address to your IP for the host.

Configuring GlassFish Server to Compress Client Files

You can improve server response times by reducing the size of the HTTP response. If you choose to implement this practice, understand that the server does more work to compress files which might impact the server's scalability under heavy loads.

To compress files sent to the client by using the GlassFish Server Administration Console:

  1. Select the Compression Minimum Size from the (Configurations/server-config/Network Config/Protocols/http-listener-1) menu in the GlassFish Server Administration Console.

  2. Using asadmin, set the server-config.network-config.protocols.protocol.http-listener-1.http.compression-min-size-bytes parameter to 2000"

    (http-listener-1 is assumed to be in use for Convergence.)

Enhancing Browser Caching of Static Files for GlassFish Server

GlassFish Server includes the Expires header in the HTTP response. The Expires header allows files cached in the browser to remain in cache for the time specified in the ExpiresFilter.class file.

To enable Expires headers:

  1. At a command prompt, change directory to Convergence_Domain.

  2. In Convergence_Domain/config/ edit the default-web.xml file.

  3. Add the following filter rule directly below the existing Servlet Mappings rules:

    <!-- Enable Expires Headers for Convergence files -->
      <filter>
        <filter-name>ExpiresFilter</filter-name>
        <filter-class>iwc.ExpiresFilter</filter-class>
      </filter>
      <filter-mapping>
          <filter-name>ExpiresFilter</filter-name>
          <url-pattern>/iwc_static/js/*</url-pattern>
          <url-pattern>/iwc_static/layout/*</url-pattern>
          <dispatcher>REQUEST</dispatcher>
          <dispatcher>FORWARD</dispatcher>
      </filter-mapping>
    
  4. In Convergence_Domain/lib/classes, create a new directory called iwc.

  5. Copy the Oracle Communications Messaging Server class file ExpiresFilter.class into the iwc directory.

  6. Restart GlassFish Server.

Tuning JVM Options

This section describes the JVM tuning options.

Activating the Garbage Collection Log

This log has negligible impact on server performance and provides valuable debugging and performance history data.

Add the following entry, using your own path. For example:

<jvm_options>-Xloggc:/opt/glassfish3/glassfish/domains/domain1/logs/gclog</jvm-options>

This log is overwritten each time the server is restarted.

Invoking the Java HotSpot Server VM

Make sure that the JVM options in the domain.xml file for the GlassFish Server instance specify -server, not -client:

<jvm-options>-server</jvm-options>

Server Class machines are defined as having at least 2 CPUs and 2 GB of memory.

Remove the -client option if present and add the -server option. You can verify what mode the server actually started with by running:

grep 'HotSpot' server.log"*,

This will show either ...Client VM... or ...Server VM.....

To configure and activate a 64-bit JVM:

  1. On Solaris, you can verify that the operating system kernel is running in 64-bit mode by running:

    /usr/bin/isainfo -kv

  2. If needed, download and install the 64-bit jvm files on the JVM instance used by the GlassFish Server on the machine. Verify the 64-bit files are available by running:

    "/server_java_dir/java -d64 -version"

  3. On GlassFish Server, replace the JVM option, -server (or -client), with -d64

Tuning the JVM Heap Size

In the GlassFish Server Administration Console, under Configurations, select server-config, then select the JVM Settings tab, then select the JVM Options sub-tab, then select Add/Modify.

The min and max heap size options are: -XmsNNNNm and -XmxNNNNm.

Generally, set max heap as large as possible given the available memory on your machine. (Setting the min equal to the max improves JVM efficiency.) Total memory used is equal to the (JVM native heap space) + (Java Heap) + (Permanent Generation space). Reserve space for the operating system and any other applications running on the machine too. Don't forget to reserve memory for the OS and avoid memory swapping at all costs.

For example, you can set the heap size options to:

<jvm-options>-Xms2048m -Xmx2048m</jvm-options>

Setting Garbage Collection Algorithms

To increase the stability and predictability of the heap size and the ratios of its configuration, you can explicitly set the following parameters:

  • When using GlassFish Server 3 with Java 7:

      • -XX:+UseParallelGC: This parameter is used by default on a machine qualifying as Server Class. This default collector is sufficient.

      • -XX:+UseParallelOldGC: This statement makes the tenured generation run GC in parallel, too. This is the default setting in JDK 6. In jdk1.5_u6 and greater, you should explicitly specify this option.

      • -XX:-UseAdaptiveSizePolicy: Turn off GC ergonomics. Note the minus sign in this statement. Specify min and max values explicitly.

      • -XX:NewRatio=1: Optimize the Young Generation Size. Using a ratio (as opposed to setting a numerical size with NewSize) allows for the maximum possible young generation size relative to the overall heap, irrespective of your MaxHeap size.

  • When using GlassFish Server 5 with Java 8, the following Garbage Collection (GC) options may get better results:

      • -XX:+UseG1GC: Use the Garbage First (G1) Collector.

      • -XX:MinHeapFreeRatio=10: Minimum percentage of heap free after GC to avoid expansion.

      • -XX:MaxHeapFreeRatio=50: Maximum percentage of heap free after GC to avoid shrinking.

      • -XX:NewRatio=1: Optimize the Young Generation Size. Using a ratio (as opposed to setting a numerical size with NewSize) allows for the maximum possible young generation size relative to the overall heap, irrespective of your MaxHeap size.

For more information about the G1 GC algorithm, see the following Oracle web site:

http://www.oracle.com/technetwork/tutorials/tutorials-1876574.html

See the discussion about Java garbage collection settings on the Oracle Technology Network:

http://www.oracle.com/technetwork/java/javase/tech/g1-intro-jsp-135488.html

Tests show that most of the objects created for Convergence are short-lived, thus benefiting from a larger young generation size.

The NewRatio means {New:Old}. So, when NewRatio=1, then new:old = 1:1. Therefore, the young generation size = 1/2 of the total Java heap. The young generation size can never be larger than half the overall heap because - in the worst case - all the young generation space could be promoted to the old generation. Therefore, the old generation must be at least as large as the young generation size.

For more information about the NewRatio option, see the following Oracle web site:

http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html

Monitor your own heap usage with JConsole. See "Monitoring Convergence" for more information.

Setting the Permanent Generation Size

Be aware that MaxPermSize may need to be increased. JVM Efficiency is improved by setting PermSize equal to MaxPermSize. Start with the default, observe PermSpace usage and adjust accordingly:

<jvm-options>-XX:PermSize=192m -XX:MaxPermSize=192m</jvm-options>

Use a tool such as Jconsole or VisualVM to determine how best to optimize your own system.

Setting the MaxMetaspaceSize in Java 8

In Java 8, Permanent Generation space is no longer used. Instead, Metaspace is introduced. Although Metaspace is expanded automatically, there might be a scenario when you want to set a limit. You can use -XX:MaxMetaspaceSize jvm option to set the limit on Metaspace size.

<jvm-options>-XX:MaxMetaspaceSize=496m</jvm-options>

Use a tool such as VisualVM to monitor your metaspace usage.

Tuning the JVM RMI GC Interval Parameters

It is better if full Garbage Collections (GCs) on the Java heap do not occur frequently and are not called explicitly. It is best to let the JVM decide when to do full garbage collections.

Unfortunately, GlassFish Server has a couple of JVM options for RMI applications that invoke full GCs often. If you are not running any applications using RMI, you should increase the rmi.dgc... values, or configure them never to occur.

You should also consider the ramifications of disabling explicit GCs. When another application is connecting to GlassFish Server with RMI, memory for objects in the Server heap will not be released and the calling application will not be able to release the reference to that object, thus possibly causing memory overflow on the other application.

These intervals are increased to 10 hours:

<jvm-options>-Dsun.rmi.dgc.server.gcInterval=36000000</jvm-options>
<jvm-options>-Dsun.rmi.dgc.client.gcInterval=36000000</jvm-options>

You can also use either of the following two options to prevent the full GCs invoked for RMI:

  • Disable explicit GC by adding:

    <jvm-options>-XX:+DisableExplicitGC</jvm-options>
    
  • Use JVM and set:

    -XX:+UseConcMarkSweepGC
    -XX:+ExplicitGCInvokesConcurrent
    

ExplicitGCInvokesConcurrent is available beginning with JVM 1.6.

Sample List of JVM Options

The following list is a sample section of the domain.xml file's JVM options:

<jvm-options>-server</jvm-options>
<jvm-options>-XX:+DisableExplicitGC</jvm-options>
<jvm-options>-XX:+UseParallelGC</jvm-options>
<jvm-options>-XX:+UseParallelOldGC</jvm-options>
<jvm-options>-XX:-UseAdaptiveSizePolicy</jvm-options>
<jvm-options>-Xms1024M -Xmx1024M</jvm-options>
<jvm-options>-XX:+UseG1GC</jvm-options>
<jvm-options>-XX:MinHeapFreeRatio=10</jvm-options>
<jvm-options>-XX:MaxHeapFreeRatio=50</jvm-options>
<jvm-options>-XX:NewRatio=1</jvm-options>
<jvm-options>-XX:PermSize=192M</jvm-options>
<jvm-options>-XX:MaxPermSize=192M</jvm-options>
<jvm-options>-Xloggc:/opt/SUNWappserver/domains/domain1/logs/gclog</jvm-options>

Tuning Oracle WebLogic Server Configuration Parameters

Oracle WebLogic Server parameters are set to 10,000 users by assuming the deployment of email, calendar, and address book services.

If you enable the default tuning for Web application in Oracle WebLogic Server, additional tuning is not required. Enable Native Input/Output if it is not enabled.

Configuring Oracle WebLogic Server to Compress Client Files

You can improve server response time by reducing the size of the HTTP response. You can improve server response times by reducing the size of the HTTP response. If you choose to implement this practice, understand that the server does more work to compress files which might impact the scalability of the server under heavy loads.

To compress files that are sent to client by using the Oracle WebLogic Server, refer to the Enabling GZIP Compression for Web Applications section in the Fusion Middleware Developing Web Applications, Servlets, and JSPs for Oracle WebLogic Server Guide.

From WebLogic Administration Console, select the Domain Name in which Convergence is deployed and modify the attributes such as GzipCompressionEnabled, GzipCompressionMinCompressionContentLength, GzipCompressionContentType in the Web Applications tab.

Enhancing Browser Caching of Static Files for Oracle WebLogic Server

You can configure enhancing browser caching of static files for Oracle WebLogic Server in Oracle HTTP Server.

See the mod_expires option in Apache HTTP Server and Third-party Modules in Oracle HTTP Server at: https://docs.oracle.com/middleware/12213/webtier/administer-ohs/under_mods.htm#HSADM1292.

Tuning the JVM Heap Size

For tuning JVM heap size on Oracle WebLogic Server Administration Console, see Oracle Fusion Middleware Tuning Performance of Oracle WebLogic Server Guide.

Generally, set max heap size as large as possible given the available memory on your machine. (Setting the min equal to the max improves JVM efficiency.) Total memory used is equal to the (JVM native heap space) + (Java Heap) + (Permanent Generation space). Reserve space for the operating system and any other applications running on the machine too. Don't forget to reserve memory for the OS and avoid memory swapping at all costs.

For example, you can set the heap size options to:

<jvm-options>-Xms3g -Xmx3g</jvm-options>

For more information on setting heap size options, see Oracle Fusion Middleware Administering Server Startup and Shutdown for Oracle WebLogic Server Guide.

You can update the startManagedWebLogic script with the required Java Heap Size in JAVA_OPTIONS. For example: JAVA_OPTIONS="-Xms3g -Xmx3g" ${JAVA_OPTIONS}.

See Starting and Stopping Servers section in the Administering Server Startup and Shutdown for Oracle WebLogic Server Guide.

Setting Garbage Collection Algorithms

To increase the stability and predictability of the heap size and the ratios of its configuration, you can explicitly set the following parameters. Oracle WebLogic Server with Java 8, the following GC options may get better results:

  • -XX:+UseG1GC: Use the Garbage First (G1) Collector.

  • -XX:MinHeapFreeRatio=10: Minimum percentage of heap free after GC to avoid expansion.

  • -XX:MaxHeapFreeRatio=50: Maximum percentage of heap free after GC to avoid shrinking.

  • -XX:NewRatio=1: Optimize the Young Generation Size. Using a ratio (as opposed to setting a numerical size with NewSize) allows for the maximum possible young generation size relative to the overall heap, irrespective of your MaxHeap size.

    For more information about the G1 GC algorithm, see the following Oracle web site:

    http://www.oracle.com/technetwork/tutorials/tutorials-1876574.html

    See the discussion about Java garbage collection settings on the Oracle Technology Network:

    http://www.oracle.com/technetwork/java/javase/tech/g1-intro-jsp-135488.html

Tests show that most of the objects created for Convergence are short-lived, thus benefiting from a larger young generation size.

The NewRatio means {New:Old}. So, when NewRatio=1, then new:old = 1:1. Therefore, the young generation size = 1/2 of the total Java heap. The young generation size can never be larger than half the overall heap because - in the worst case - all the young generation space could be promoted to the old generation. Therefore, the old generation must be at least as large as the young generation size.

For more information about the NewRatio option, see the following Oracle web site:

http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html

Monitor your own heap usage with JConsole. See "Monitoring Convergence" for more information.

Miscellaneous Performance Tuning Tips

  • Class Data Sharing

    Class data sharing (CDS) is a new feature in J2SE 5.0. CDS applies only when the "Java HotSpot Client VM" is used. Since we recommend using the "Java HotSpot Server VM," this feature does not apply.

  • Inspect Settings

    Inspect your settings with the following commands. To see all Java processes running on your machine:

    jps -mlvV
    

    To view your settings in effect for the JVM for Oracle certified application server:

    jmap -heap java_process_id
    
  • Monitoring the JVM

    JConsole is a built-in JVM monitoring tool. On the SUT, set the display variable to your local machine and run the following command: jconsole

    See the Jconsole documentation for more information.

  • UseConcMarkSweepGC

    The intrepid system administrator may want to consider using UseConcMarkSweepGC instead of UseParallelGC. See the Java SE VM documentation at the following Oracle web site for more information:

    http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html

  • GC 1 Algorithm

    See the discussion about Java garbage collection settings on the Oracle Technology Network:

    http://www.oracle.com/technetwork/java/javase/tech/g1-intro-jsp-135488.html

  • AggressiveOpts

    You can turn on point performance compiler optimizations that are expected to be default in upcoming java releases for better performance using the AggressiveOpts option.

    <jvm-options>-XX:+AggressiveOpts</jvm-options>