[Bug 541520] Re: Using incorrect JVM Garbage Collector
Aaron J. Zirbes
ajz at umn.edu
Wed Apr 21 21:45:46 BST 2010
I'm OK with moving the "-Xmx128M" parameter out onto one of the comment
lines as this is a commonly known and understood parameter. Most google
(bing?) searches will advise you to adjusting this parameter when you
come upon memory problems.
If we want to ensure that we don't assign "UseConcMarkSweepGC" on
single-core processors, the installer script could check for this by
doing something sneaky like...
CORE_COUNT=`grep -E "^processor\s*:" /proc/cpuinfo | wc -l`
if ((( $CORE_COUNT > 1 ))) then
JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC"
fi
As I've never written post-install scripts I'm not sure how hard this
would be, but it's a thought.
Theoretically it could be added to /etc/init.d/tomcat6...
(P.S. Don't trust my BASH syntax, I didn't test it. Treat it as
pseudo-code.)
--
Aaron
Gabriel Nell wrote:
> The point that "we know something the JVM can't know", eg, that this JVM
> is running a web server, is fair. I'm still not convinced that
> specifying the CMS collector is the right application of this knowledge,
> and I'm new to Ubuntu (from a contributor standpoint, anyway) so I don't
> know what the project goals are for the default configuration. But for
> now let me move down what I hope is a fruitful path. It sounds like (and
> please correct me if I'm wrong) we want to choose settings that:
>
> 1) at a minimum, "work" (eg, after running apt-get, tomcat actually boots up and serves requests)
> 2) has reasonable defaults to suit the sort of hardware we expect people to run web servers on
>
> Currently our defaults are:
>
> -Xmx128M -XX:+UseConcMarkSweepGC
>
> Which satisfies #1, but I still think is not great for #2. Maybe as you
> alluded we'd do better by not specifying the maximum heap size? The
> rationale was that 64MB is not usually enough, and that made sense under
> JDK1.4, when this was the default heap size. However it looks like in
> 1.5 and later, the heap selection was changed to be based on the amount
> of available RAM
>
> ***
> initial heap size:
> Larger of 1/64th of the machine's physical memory on the machine or some reasonable minimum. Before J2SE 5.0, the default initial heap size was a reasonable minimum, which varies by platform. You can override this default using the -Xms command-line option.
>
> maximum heap size:
> Smaller of 1/4th of the physical memory or 1GB. Before J2SE 5.0, the default maximum heap size was 64MB. You can override this default using the -Xmx command-line option.
> ***
>
> So if we don't give any heap parameters to the JVM:
>
> - The heap will be at least 128MB (satisfy goal #1) on any machine with 512MB or more of RAM
> - The JVM is free to choose a heap much larger than 128MB, based on the available memory (satisfy goal #2)
>
> For this reason I'd suggest we remove the "-Xmx128M" portion from the
> command line.
>
> References:
> http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html#par_gc.ergonomics.default_size
> http://java.sun.com/javase/6/docs/technotes/guides/vm/gc-ergonomics.html
> http://java.sun.com/docs/hotspot/gc5.0/ergo5.html
>
>
--
Using incorrect JVM Garbage Collector
https://bugs.launchpad.net/bugs/541520
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to tomcat6 in ubuntu.
More information about the Ubuntu-server-bugs
mailing list