I have a JSP/Servlet application using a session attribute and JDBC to update and query the database (Oracle) using Orion web server. In other words, it's very memory intensive. For one part of the application, I insert, update, do 3 queries on one servlet and pass the data as a Javabean to a JSP. Once in a while, I've been getting an "OutOfMemory" message. However upon review of the classes using the HAT log, my classes are garbage collected. I have increased the maximum memory allocation to 80m and it's working fine for now. My question is since this application will be used by 2000 people, should I increase the memory using Xmx? If yes, what is the max memory? Thanks.
Initially, your memory must have been so low that garbage collection could not reclaim enough of it for your application to continue running. This might have occured due to a single thread requiring more memory than your maximum. I've found that 256m is a decent max setting for a memory-intensive app (that is, if your server has enough memory to allow that). These are the memory options I use:
-XX:NewSize=128m -XX:MaxNewSize=128m -XX:SurvivorRatio=4 -XX:MaxHeapFreeRatio=80 -XX:MinHeapFreeRatio=20 -ms256m -mx256m
Those XX options are for GC tuning and do not work in older JVMs (pre-1.3?).
Let's say that each thread eats up 20m per request. That's really a lot, but even still it is much less than 256. You shouldn't get an exception for being out of memory. Your GC will be running constantly though, but it should scale up to a degree. You'll find that GC has become your bottleneck. Use -verbose:gc to see when GC kicks in.
Where can I find all docs for -XX options.