Arjen,

On Oct 20, 2015 4:35 PM, "Arjen van der Meijden" <acmmail...@tweakers.net>
wrote:
>
> Afaik, in modern JVM versions, many of the 'old' recommendations may not
> really apply anymore or even reduce performance. The book 'Java
> Performance: The Definitive Guide' for instance has this statement on
> heap sizing:
>
> "1. The JVM will attempt to find a reasonable minimum and maximum heap
> size based on the machine it is running on.
> 2. Unless the application needs a larger heap than the default, consider
> tuning the performance goals of a GC algorithm (given in the next
> chapter) rather than fine-tuning the heap size."
>
> So basically; see how it works first without specifying any limit (so
> not 1GB either) and/or fiddle with the goals rather than the size of the
> heap. If you need a certain minimum heap, for instance to offer
> sufficient space for the 'memory'-store of ActiveMQ, you should
> obviously specify at least that.
>
> -XX:+UseTLAB; is enabled by default, so specifying it won't do anything :)
>
> -Xms2G and -Xmx2G; forcing the min and max to the same value is not a
> necessity for modern JVM's, it will also force the JVM in making
> (potentially) less than optimal allocations for the various areas in the
> HEAP and disable automatic resizing. On the other hand, it allows the
> JVM to skip the resizing process altogether, so it can gain a bit
> performance because of that as well.

I removed the options that you mentioned above, and I see that min heap is
500kb and max is 8GB, and jvisualvm confirms that my app maxes out at 500kb
when monitoring 12+ hours. Thanks for the recommendation.

It's interesting, prior to these changes that I did, above, my app was
starting to max out at 1.5 GB over some number of hours (or days).

>
> -XX:+UseConcMarkSweepGC; this GC-variant will reduce pause times, but on
> the cost of more cpu (although that may be worth it) and a bit less
> effective GC (compared to the parallel GC). If your application is
> sensitive to those long pauzes (which may be noticable at both the
> producer and consumer sides) selecting either CMS or G1 may indeed be a
> good choice. For heaps below 4GB, CMS is expected to outperform G1
> (although that statement doesn't say G1 will always outperform CMS for
> heaps above 4GB).

So, now I'm wondering if I should set max to 4GB, since my app maxes out at
500kb, and based on what you mentioned/recommended above.

>
> Best regards,
>
> Arjen
>
> On 20-10-2015 21:51, Howard W. Smith, Jr. wrote:
> > My recommendation (what i'm using for my java web app using latest Java
8
> > version):
> >
> > -Xms2G
> > -Xmx2G
> > -XX:+UseTLAB
> > -XX:+UseConcMarkSweepGC
> > -XX:+CMSClassUnloadingEnabled
> >
> > I've seen it recommended to make min and max the same value for best GC,
> > but feel free to google/confirm that. :)
> >
> >
> >

Reply via email to