Memory settings for Railo/Tomcat - UseCompressedOops?

408 views
Skip to first unread message

Derrick Peavy

unread,
Oct 11, 2011, 7:31:06 PM10/11/11
to Railo
Still trying to figure out some memory issues.

Ubuntu 11.04 server (64 bit)
Java 1.6.0_22 (OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode))
Tomcat 6
Railo 3.2.3.000

I have Tomcat set to use 4 GB of RAM on a dedicated box with a total
of 48 GB of RAM.

I'd like to up that to handle larger data processing tasks. Not
efficient, but certainly effective. Ran out of memory at 1 GB setting
when parsing a large XML feed.

So, under /tomcat/bin I have a setenv.sh file with the following:

export JAVA_OPTS="-server -Xmx2g -XX:MaxPermSize=8g -XX:
+UseCompressedOops -Djava.awt.headless=true"

What is the max memory that I can assign here?

Does UseCompressedOops make any difference in performance or speed?

Josh Nathanson

unread,
Oct 11, 2011, 7:41:11 PM10/11/11
to ra...@googlegroups.com
I could be wrong but I thought PermSize would generally be set to be less than Xmx?

I would think something like Xmx 8g, Xms 8g, permSize 2g would be more what you're looking for.

-- Josh

Josh Nathanson

unread,
Oct 11, 2011, 7:43:58 PM10/11/11
to ra...@googlegroups.com
Here is a good article on JVM tuning:


-- Josh

Sean Corfield

unread,
Oct 11, 2011, 8:05:31 PM10/11/11
to ra...@googlegroups.com
On Tue, Oct 11, 2011 at 4:31 PM, Derrick Peavy <der...@derrickpeavy.com> wrote:
> export JAVA_OPTS="-server -Xmx2g -XX:MaxPermSize=8g -XX:
> +UseCompressedOops -Djava.awt.headless=true"

You certainly do not want MaxPermSize=8g - The PermSize is for
permanent storage such as class file representation so it's generally
only 256m or less for most people.

Setting -Xmx2g gives you 2GB of heap which may be sufficient (you
generally don't want a heap much bigger than 2GB because of the time
spent doing GC... 3GB tops).

You will want to set -Xms to the same as -Xmx so the heap is
pre-allocated and the JVM doesn't have to deal with growing the heap.

To get more transparency into GC behavior, you need to turn on GC
logging so you can see what's going on. You probably want to ensure
RMI GC doesn't occur too often, select the CMS collector and make any
explicit GCs use that too.

Here's what we're currently using at World Singles:

JAVA_OPTS="-Dsun.rmi.dgc.client.gcInterval=600000
-Dsun.rmi.dgc.server.gcInterval=600000 -Xms2560m -Xmx2560m
-XX:+ExplicitGCInvokesConcurrent -XX:+UseConcMarkSweepGC
-XX:MaxPermSize=512m -XX:+PrintGCDetails -XX:+PrintGCTimeStamps
-verbose:gc -Xloggc:${CATALINA_BASE}/logs/gc.log"; export JAVA_OPTS

That's in {tomcat}/bin/setenv.sh along with:

TCHOME=/opt/tomcat
CATALINA_BASE=$TCHOME; export CATALINA_BASE

(just to show what CATALINA_BASE is set to)

Note that Railo requests a full GC every minute so you can either turn
that off (by disabling explicit GC) or make it use CMS as we've done
above.

> What is the max memory that I can assign here?

You say "I have Tomcat set to use 4 GB of RAM" but you don't indicate
how you've done that. Since Tomcat is "just" a Java application, it'll
use whatever Java wants, based on the JVM options you provide (in your
case 2G heap and 8G permsize).

> Does UseCompressedOops make any difference in performance or speed?

I'd never heard of that option so I had to Google it. It doesn't sound
like it's widely available?

http://blog.juma.me.uk/2008/10/14/32-bit-or-64-bit-jvm-how-about-a-hybrid/

"Compressed Oops have been included (but disabled by default) in the
performance release JDK6u6p (requires you to fill a survey)"

So I wouldn't worry about that...
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

Derrick Peavy

unread,
Oct 11, 2011, 8:34:25 PM10/11/11
to Railo
Sean, Josh,

thank you both! Very informative and I am reading both your posts and
links now. WIll tinker accordingly within the values you laid out.

Very helpful!

-Derrick

On Oct 11, 8:05 pm, Sean Corfield <seancorfi...@gmail.com> wrote:
> http://blog.juma.me.uk/2008/10/14/32-bit-or-64-bit-jvm-how-about-a-hy...
>
> "Compressed Oops have been included (but disabled by default) in the
> performance release JDK6u6p (requires you to fill a survey)"
>
> So I wouldn't worry about that...
> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View --http://corfield.org/
> World Singles, LLC. --http://worldsingles.com/
> Railo Technologies, Inc. --http://www.getrailo.com/
Reply all
Reply to author
Forward
0 new messages