Ultimately, your JVM heap size will likely be somewhere in the 4GB to 12GB
range. Alas, you have to use trial and error to size it. If it's too small
you will hit OOM or performance degradation due to frequent GC. If it's too
large you will accumulate way too much garbage before a GC hits and then
the GC will take too long and even OOM if load is heavy enough to interfere
with GC. So, you're looking for a size where there is enough heap to avoid
OOM, plus a margin to allow for index growth and spikes in query load, but
not so small that GC occurs way too frequently. A simple binary search can
be used to find this sweet spot:

1. Pick a likely workable size, like 8 GB.
2. Index an amount of data that is either the real, intended load or a
simulation of that load and hit with plenty of queries, including complex
and expensive ones. (This should all be some automated test.)
3. If you hit OOM or performance is bad, repeat test with a heap size that
is half again bigger, like 12 GB. With each iteration, divide the increment
by 2 (8 GB, 4GB, 2GB, 1GB)
4. If you don't hit OOM and performance is decent, repeat test with a heap
size that is half again smaller, like 4GB.
5. Once you get to the point where you have tested two configs that differ
only by 1GB or less, you're done.
6. If the final smaller heap doesn't OOM, use it, otherwise use the larger
config
7. Add 10% to 20% (or even 25%) or so to that minimal working config, like
from 8GB to 10GB to have room to expand and handle spikes.
8. Run that final config for an extended period (days) with as realistic a
load as possible
9. If it too hits OOM or frequent GC, you may have to bump up the heap some
more, like another 10%.


-- Jack Krupansky

On Fri, Jan 29, 2016 at 11:51 AM, Erick Erickson <erickerick...@gmail.com>
wrote:

> And adding to Shawn's comment you want to have as little JVM as possible,
> see:
> http://blog.thetaphi.de/2012/07/use-lucenes-mmapdirectory-on-64bit.html
>
> Best,
> Erick
>
> On Fri, Jan 29, 2016 at 5:02 AM, Shawn Heisey <apa...@elyograg.org> wrote:
> > On 1/28/2016 10:24 PM, Midas A wrote:
> >> CPU : 4
> >> physical memory : 48 GB
> >>
> >>
> >> and we are only have solr on this server . How much JVM  can be
> allocate to
> >> run server smoothly.
> >
> > We don't know.  You haven't provided any information about your index or
> > how you use it.  Even if you do provide that information, any number
> > that we gave you might be completely wrong, and should be viewed as
> > *only* a starting point.
> >
> >
> https://lucidworks.com/blog/sizing-hardware-in-the-abstract-why-we-dont-have-a-definitive-answer/
> >
> > Thanks,
> > Shawn
> >
>

Reply via email to