Howdy, A few things. First, you original question: >"To collect data on how long garbage collection is taking add the >-verbose:gc argument to your CATALINA_OPTS environment variable when >starting Tomcat.When verbose gc is enabled your >$CATALINA_BASE/logs/catalina.out log file will include data for every >garbage collection including how long it took." > >Have anybody got to see GC output in catalina.out log? ?
Yes. Every single time I've followed the above instructions, I see verbose gc in my catalina.out file. If I use JDK 1.4 with the loggc:<file> option, it goes to that file. If I omit that option and enable swallowOutput for the Logger in server.xml, the verbose gc information goes there. I've had no problems with this at all. In fact I've tested this functionality on every point release from 4.0.1 to now. All my attempts are on linux and Solaris platforms. I wouldn't run anything serious on a Windows box any time soon. It may be that some of the above doesn't work on windows, or when running tomcat on windows as a service, which you mentioned is your deployment setup. >There are a lot of people out >there who have implemented tomcat in production environment and we as >starters would like to know how they managed some of the delicate issues >like this. Assuming you mean deployed instead of implemented, I agree. But I think the above number is far exceeded by the number of people who believe there are magic garbage collection tuning settings that'll make all the GC problems go away. >Off late there have been many queries about memory management and the >reason behind this is because people get bombarded with "out of memory >error". Not just of late. For a long long time now. And not just on the tomcat lists either. It's a difficult topic that many people struggle with. >now, still without any right answers even after searching the archives. See above: the right answer is one only you can find for your own particular app. There's no magic GC combination that'll perfectly tune your JVM. What worked for others may not work for you. >Different JVM's do memory management in its own way and that is even >more confusing. It may be confusing. But in fact, as someone who's written a JVM, memory management and efficient collection are distinguishing factors. It's a key value added if you can do it well: hence JRockit and others. >You start tomcat with -verbose:gc, you can see GC kicks in even as it Yup. All the time. This is normal and expected. They're usually incremental or young generation GCs. >starts. From what I learnt from java.sun.com, a full GC kicks in only >after it reaches its max heap. But you can see Full GC's in the verbose >output even before the JVM reaching its max heap. No, that's not true at all. A full GC may kick in long before max heap is allocated. In fact, the JVM will usually try to never even get close. By default the minimum percentage of the heap it'll try to keep free is 40%. You can tune this with XX:MaxHeapFreeRatio=<Maximum> and -XX:MinHeapFreeRation=<Minimum> >By the way I have gone through the entire archive about this topic and >none of them give a final answer. Again, what's a final answer? What sort of answer would you have liked to see that wasn't in the archives? It may be that the only "final" answer is: - Come up with performance goals - Come up with performance tests - Run tests, record results - If goals are met, stop, else - Modify one GC parameter - Run tests, records results - Repeat until goals are met. Yoav Shapira Millennium ChemInformatics -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>