I was just trying to help someone out with an XML parsing issue from an ATOM feed but every time I tried to load the feed's URL (whether through CFFEED or CFHTTP), I kept getting an Out of Memory exception from Railo/Tomcat. Up until today when I made the change below, Tomcat started with a ridiculously low 80-90 MB of RAM and never seemed to top the 128 MB level. Clearly, I need a little more horse (uh, ram) power.
Since I'm still quite green when it comes to Java servers, I thought I would post this in the event someone out there is also trying to figure out how to up Tomcat's (v6.0.8) memory. I wasn't sure where (i.e., in which file) I could apply a setting to give Tomcat more RAM -- or in which command/variable I would declare it!
The key to upping Tomcat's memory is the JAVA_OPTS variable (Java runtime options). Finding out where to up this setting was shockingly easy. After a couple of spins around Google, I found a post that pointed to the Catalina startup script. So, I opened up catalina.sh with TextMate (this file is located in Tomcat's bin folder).
Next, I searched for JAVA_OPTS. I found the following line:
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
All I did was change it to:
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms128m -Xmx512m"
I restarted Tomcat and I was good to go. Tomcat still only used about 90 MB when it fired up but as soon as I went to parse a 3 MB XML file, no more out of memory errors. Rather than getting an OOM exception, Tomcat's RAM usage increased to 196 MB, something it never did before. What I found cool is that it did not spike from there. I ran the parsing page several times, Tomcat stayed steady at 196. Good kitty! I mean, yeah Tomcat.
Since I'm still quite green when it comes to Java servers, I thought I would post this in the event someone out there is also trying to figure out how to up Tomcat's (v6.0.8) memory. I wasn't sure where (i.e., in which file) I could apply a setting to give Tomcat more RAM -- or in which command/variable I would declare it!
The key to upping Tomcat's memory is the JAVA_OPTS variable (Java runtime options). Finding out where to up this setting was shockingly easy. After a couple of spins around Google, I found a post that pointed to the Catalina startup script. So, I opened up catalina.sh with TextMate (this file is located in Tomcat's bin folder).
Next, I searched for JAVA_OPTS. I found the following line:
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
All I did was change it to:
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms128m -Xmx512m"
I restarted Tomcat and I was good to go. Tomcat still only used about 90 MB when it fired up but as soon as I went to parse a 3 MB XML file, no more out of memory errors. Rather than getting an OOM exception, Tomcat's RAM usage increased to 196 MB, something it never did before. What I found cool is that it did not spike from there. I ran the parsing page several times, Tomcat stayed steady at 196. Good kitty! I mean, yeah Tomcat.
http://groups.google.com/group/railo/browse_thread/thread/658561fcd121a470/8e198b8c13e4baf3?lnk=raot