----- Original Message ----- > From: celtic man <dheerajman...@hotmail.com> > To: users@tomcat.apache.org > Cc: > Sent: Friday, November 11, 2011 8:40 AM > Subject: Re: JVM config for tomcat7.0.19 > > > Is this JAVA setting below OK ? > > cat /proc/meminfo > MemTotal: 4149124 kB > MemFree: 457884 kB > > 4Gb total memory on the linux box and have 0.4GB free memory and > tomcat(6.0.18) running with below : > > JAVA_OPTS=-Xmx2000M so that i.e 1.9GB ?? > > or please suggest me the best settings that i add and not have any memory > leak issues on the application.. > > > > Pid * wrote: >> >> On 10/11/2011 22:45, Igor Cicimov wrote: >>>> >>>> JAVA_OPTS=-Xms2048M -Xmx2048M -XX:Permsize=512m > -XX:MaxPermsize=512m >>>> >>> >>> You are allocating here 2.5GB of memory to tomcat ... how do you expect >>> it >>> to start on a box with 2GB in total of which only 500MB are available? >> >> +1 It's the perfect way to achieve shockingly bad performance. >> >> >> p >> >> >>> On Fri, Nov 11, 2011 at 8:25 AM, Christopher Schultz < >>> ch...@christopherschultz.net> wrote: >>> >>> Celtic, >>> >>> On 11/10/11 12:02 PM, celtic man wrote: >>>>>> So i have updated the setenv.sh with -Xms2048M -Xmx2048M >>>>>> -XX:Permsize=512m -XX:MaxPermsize=512m and restarted > tomcat.. >>> >>> Where is setenv.sh located? Can you give us the full contents of that >>> file? >>> >>>>>> but when i grep for tomcat process i don't see it .. >>>>>> >>>>>> ps -ef | grep tomcat root 10959 1 19 14:57 pts/4 >>>>>> 00:00:29 /appl/java/bin/java -Dnop >>>>>> > -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager >>>>>> -Djava.endorsed.dirs=/appl/tomcat/endorsed -classpath >>>>>> > /appl/tomcat/bin/bootstrap.jar:/appl/tomcat/bin/tomcat-juli.jar >>>>>> -Dcatalina.base=/appl/tomcat -Dcatalina.home=/appl/tomcat >>>>>> -Djava.io.tmpdir=/appl/tomcat/temp >>>>>> org.apache.catalina.startup.Bootstrap start >>> >>> How are you starting Tomcat? Give us the exact command you are running. >>> >>> -chris
That memory listing is really a snapshot of what's going on in your system. Without more information, it's impossible to say. You really need to do a few things here in order to figure out optimal memory settings. From a systems standpoint: 1. Read about how memory management works on a Linux system. Here are a few quick references (search for more) http://youadmin.net/wiki/Linux:RedHat_meminfo_metrics http://www.redhat.com/magazine/001nov04/features/vm/ http://www.linuxweblog.com/meminfo 2. Run some long term monitoring on your system. vmstat iostat sar Plotting vmstat and iostat over a period of time when your application is being heavily used is useful. Use the above tools to tune your system. From an applications standpoint: You mention a memory leak in your application. Feeding it more memory will just delay the inevitable. You need to fix your leaks. First of all, you need to determine if you have a leak. Tools like JConsole, VisualVM, and mat will help with this. Mark Thomas has given a nice presentation on out of memory issues. He's posted the link in the mailing list several times. I found one link here: http://www.infoq.com/presentations/Diagnosing-Memory-Leaks Once you've fixed memory leaks in your application, you'll then (with information available from the tools above) be able to set appropriate Xmx and XX:MaxPermSize. Note, PermSize issues can be related to classes in your application registering themselves with a class loaded in a parent classloader. When you undeploy or redeploy your application, references stay around and you'll eventually get a PermGen space exception. A good explanation (along with an example to illustrate PermGen issues) can be found here: http://blogs.oracle.com/fkieviet/entry/classloader_leaks_the_dreaded_java In short: 1. Measure system with system tools such as vmstat 2. Measure application with tools such as jconsole, visualvm, mat 3. Fix memory leaks (resource and classloader) 4. Then set memory based on the information from the first 3 steps . . . just my two cents. /mde/ --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org