RHEL / OpenJDK – Performance Tuning

January 8, 2013

Administration, Data Grid

This post highlights three performance tuning techniques for Red Hat Enterprise Linux (6.2) and OpenJDK (1.6): TCP send / receive windows, large page memory, and i-CMS.

These techniques are particularly applicable to data grids or to any distributed system that stores a lot of data.

I just finished a technical white paper on JBoss Data Grid (JDG) performance factors, and these techniques were necessary for JDG to perform at its best.

Networking

Set the maximum size of the TCP send / receive windows of the accordingly.

Example: 640K Send Window / 25MB Receive Window

echo 655360 > /proc/sys/net/core/wmem_max
echo 26214400 > /proc/sys/net/core/rmem_max

Memory

Configure large page memory. More information about large page memory can be found here.

Example: A server with 16GB of memory with 12.5GB of it reserved for large page memory.

echo 17179869184 > /proc/sys/kernel/shmmax
echo 6400 > /proc/sys/vm/nr_hugepages
echo 500 > /proc/sys/vm/hugetlb_shm_group

Update the resource limits.

/etc/security/limits.conf

jboss      soft   memlock      unlimited
jboss      hard   memlock      unlimited

Set the JVM options.

Note: The heap size (12GB) is less than the amount of memory reserved for large page memory (12.5GB) as the heap is not the only memory used by the JVM.

-Xms12G -Xmx12G
-XX:+UseLargePages

Garbage Collection

Use the Concurrent Mark Sweep (CMS) garbage collector in Incremental mode (i-CMS).

-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode
, , ,

About Shane K Johnson

Technical Marketing Manager, Red Hat Inc.

View all posts by Shane K Johnson

9 Comments on “RHEL / OpenJDK – Performance Tuning”

  1. java Says:

    nice performance tuning tips. Are these applicable to other JDK like jrockit?

    Reply

    • Shane K Johnson Says:

      While I am running RHEL and OpenJDK, these techniques (large page memory / i-CMS) should be applicable to any other JVM including JRockit.

      Reply

  2. James Holland (@j_w_holland) Says:

    Would this be applicable to running JBoss as well?

    Reply

    • Shane K Johnson Says:

      It would. If your application servers are clustered, it is worth updating the TPC send / receive windows. If your application requires a lot of memory, it is worth configuring and enabling large page memory. However, your choice in garbage collector will depend on your application requirements. I chose the concurrent collector because I wanted to minimize GC pause time. If I wanted to maximize peak performance, I might have selected the parallel collector.

      Reply

  3. neomatrix369 Says:

    Reblogged this on Mani's useful blogs and commented:
    Short and sweet blog on Performance tuning!

    Reply

  4. Java Tutorials Says:

    Great read, this can be very useful to any Java J2EE developer

    Reply

  5. Thomas Says:

    Just a quick comment. AFAIK If you enable huge pages it’s in most situations also recommended to turn off transparent huge page in RHEL 6. This can be done by the following command:

    $ echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled

    Thanks for a otherwise good and very prices guide.

    Reply

Trackbacks/Pingbacks

  1. » Enlaces de interés. 5ta. Búsqueda - January 23, 2013

    [...] Trucos para afinar el rendimiento de Red Hat Enterprise Linux (6.2) y OpenJDK (1.6) [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 117 other followers

%d bloggers like this: