Where did you read anything about a 2G heap being “in the danger zone”? I 
routinely see heap sizes in the 16G range and greater. The default 512M is 
actually _much_ lower than it probably should be, see: 
https://issues.apache.org/jira/browse/SOLR-13446

The “danger” if you allocate too much memory is:

1> the OS needs some physical memory to hold the MMap’ed index, see: 
http://blog.thetaphi.de/2012/07/use-lucenes-mmapdirectory-on-64bit.html

2> If you allocate lots more heap than you actually need, garbage collection 
can take longer.

My general rule is to _start_ with allocating no more than 50% of the available 
physical memory to Solr’s heap. In your case, since you’ve been running with 
512M 1G is perfectly reasonable, assuming you have at least 2G  physical 
memory. 

One common misconception is “if a 1G heap is good, 8G would be even better”. 
This is not true, you should only assign the heap as much memory as you need to 
avoid GC issues and OOMs. In your case, 1G is fine, 2G would also be fine 
(since GC on a 2G heap is pretty fast), but no more than that until you have 
some evidence you need it.

Best,
Erick

> On Jul 24, 2019, at 3:48 AM, Jörn Franke <jornfra...@gmail.com> wrote:
> 
> I think you can safely increase heap size to 1 gb or what you need.
> Be aware though:
> Solrs performance depends heavily on file system caches which are not on the 
> heap! So you need more memory than what you configure as heap freely 
> available. How much more depends on your index size. 
> 
> Another option would be to optimize the queries and maybe index, but this 
> also costs time and since you do not have a really big heap.
> 
>> Am 23.07.2019 um 22:36 schrieb Mandava, Rahul <manda...@upmc.edu>:
>> 
>> I am using SOLR version 6.6.0 and the heap size is set to 512 MB, I believe 
>> which is default. We do have almost 10 million documents in the index, we do 
>> perform frequent updates (we are doing soft commit on every update: heap 
>> issue was seen with and without soft commit) to the index and obviously 
>> search heavily. We have experienced Heap space out of memory exception twice 
>> so far in the whole year span since we started using SOLR. Since we are just 
>> using default value for heap size, I am thinking to increase it and I do 
>> know that high heap size can slow down the performance due to GC pauses. As 
>> we can’t really come up with an ideal number that can work with any 
>> scenario, I want to increase it to just 1gb only.
>> 
>> I did some reading around this, in which I learned that there can be lot of 
>> parameters that contribute to this issue and there is no perfect way to 
>> address this. And also read that increasing heap size above 2gb is where we 
>> definitely be in the danger zone, since I am thinking to increase it to just 
>> 1gb and if I monitor the consumption on a daily basis for a while, I should 
>> be good and resolve the heap memory issue. Is that a safe assumption ??
>> 
>> Does anyone has experienced similar issue ?? Any thoughts or suggestions ??
>> 
>> 
>> Below are heap usages if it helps. Usage was almost 490 mb, which makes me 
>> feel with the load we have 512 mb is not enough and should be good if I 
>> increase it to 1gb.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> Thanks

Reply via email to