Changing Railo JVM Memory Settings

Author: Steven Neiland

Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

So last week I started to get error alerts from my server around the time a new blog post was auto published. A quick ssh in and I could see that java (ie railo) was eating a whole load of cpu cycles but was not really consuming a lot of memory. It was at this point that it occurred to me that I had never changed the default memory settings when I installed railo.

Basically I was running railo with a memory limit of 256m on a machine that had 4gb free...well duh of course I was going to have problems.

Changing the JVM memory Settings

To change the memory settings for railo you need to locate the file. This is located at "{railoinstalldir}/tomcat/bin/".

Open this file for editing and look for this line:

JAVA_OPTS="-Xms128m -Xmx256m -XX:MaxPermSize=64m ";

There are three settings in megabytes here that we can modify:

  1. Xms: The minimum heap size.
  2. Xmx: The maximum heap size.
  3. MaxPermSize: The max perm space size.

Its tempting to just max all the values out, but the bigger the values the harder garbage collection has to work. Also many people advocate setting Xms and Xmx to the same value to remove any lag from the jvm expanding its memory footprint from the min up to the max, however for my little server I dont mind a little lag if I dont need to use the entire max value.

For myself I doubled the Xms value since I knew I was already hitting 256m memory usage and I set the Xmx value to 1024m to begin with as it is well within my free memory availablility. Finally I doubled the maxpermsize.

I will admit this is not a very scientific approach, but later on down the line when I have time I will hook up JConsole and really see whats going on.

Related Blog Postings

Reader Comments

  • Please keep comments on-topic.
  • Please do not post unrelated questions or large chunks of code.
  • Please do not engage in flaming/abusive behaviour.
  • Comments that contain advertisments or appear to be created for the purpose of link building, will not be published.

Archives Blog Listing