You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by HariBabu kuruva <ha...@gmail.com> on 2023/03/08 16:24:20 UTC

Solr Heap Memory Settings

Hi All,

I have set the Heap memory as -Xms 1g -Xmx 40g in the Production
environment.

But when i see the Heap memory in the Solr UI. I can see the Max Heap below.

Max: 3.8Gb
Used: 2.2Gb

Could you please help me understand, how is it showing the Max Heap as
3.8Gb. I have 10 solr nodes, it shows different Heap memory for each node(
in the UI), though I have set it as  -Xms 1g -Xmx 40g in all the 10 nodes.


-- 

Thanks and Regards,
 Hari
Mobile:9790756568

Re: Solr Heap Memory Settings

Posted by Jan Høydahl <ja...@cominvent.com>.
Hi,

There should be no spaces, try -Xms1g.

If you add the sapce, Java will likely fall back to defaults, which is a certain percentage of physical mem.
See https://stackoverflow.com/questions/4667483/how-is-the-default-max-java-heap-size-determined

You should follow our advice on memory tuning https://solr.apache.org/guide/solr/latest/deployment-guide/jvm-settings.html#choosing-memory-heap-settings
Most likely 40g is too much, and you should set min and max to the same value. I'd try with -Xms8g -Xmx8g and tune from there. You should MINIMIZE the Java heap to gain best possible Linux-level caching.

Jan

> 8. mar. 2023 kl. 17:24 skrev HariBabu kuruva <ha...@gmail.com>:
> 
> Hi All,
> 
> I have set the Heap memory as -Xms 1g -Xmx 40g in the Production
> environment.
> 
> But when i see the Heap memory in the Solr UI. I can see the Max Heap below.
> 
> Max: 3.8Gb
> Used: 2.2Gb
> 
> Could you please help me understand, how is it showing the Max Heap as
> 3.8Gb. I have 10 solr nodes, it shows different Heap memory for each node(
> in the UI), though I have set it as  -Xms 1g -Xmx 40g in all the 10 nodes.
> 
> 
> -- 
> 
> Thanks and Regards,
> Hari
> Mobile:9790756568


Re: Solr Heap Memory Settings

Posted by Dave <ha...@gmail.com>.
-Xms30000M
-Xmx30000M

Keep them the same, no spaces, I preferred to use M , never go above 32g cause reasons (jvm gets weird after 32) and make sure your machine still has the memory to hold your index. 

> On Mar 8, 2023, at 11:27 AM, HariBabu kuruva <ha...@gmail.com> wrote:
> 
> Hi All,
> 
> I have set the Heap memory as -Xms 1g -Xmx 40g in the Production
> environment.
> 
> But when i see the Heap memory in the Solr UI. I can see the Max Heap below.
> 
> Max: 3.8Gb
> Used: 2.2Gb
> 
> Could you please help me understand, how is it showing the Max Heap as
> 3.8Gb. I have 10 solr nodes, it shows different Heap memory for each node(
> in the UI), though I have set it as  -Xms 1g -Xmx 40g in all the 10 nodes.
> 
> 
> -- 
> 
> Thanks and Regards,
> Hari
> Mobile:9790756568

Re: Solr Heap Memory Settings

Posted by Dave <ha...@gmail.com>.
No. Don’t breach 31gb unless you go all the way to 47 plus. Where you’re at sounds pretty good if you index is less than 30 gb so it can get set into memory

> On Mar 14, 2023, at 1:39 AM, HariBabu kuruva <ha...@gmail.com> wrote:
> 
> Thank you all for your responses.
> 
> There are no spaces between Xms and the values.
> 
> I have updated similar arguments(-Xms30720m -Xmx30720m) in one of the
> non-prod environments(in mbs instead of gb). It correctly shows the max
> heap as 30GB in the Solr UI.
> 
> So, I would like to update 31.5 GB similarly in PROD (-Xms32256m
> -Xmx32256m). Before applying that should i analyze heap memory stats using
> Heap analyzer tool or i can go ahead and apply. I have a total server
> memory of 62GB and only solr is running in it. Please suggest.
> 
> 
>> On Thu, Mar 9, 2023 at 8:00 PM Walter Underwood <wu...@wunderwood.org>
>> wrote:
>> 
>> Use a heap analysis tool. You’ll see a sawtooth pattern in the heap size.
>> The bottom of that sawtooth is the actual amount of memory that Solr is
>> using. Pick the highest point of the bottom of the sawtooth, then add some
>> headroom, maybe a gigabyte. Test with that value.
>> 
>> wunder
>> Walter Underwood
>> wunder@wunderwood.org
>> https://observer.wunderwood.org/ (my blog)
>> 
>>>> On Mar 9, 2023, at 5:23 AM, Dave <ha...@gmail.com> wrote:
>>> 
>>> Agreed, but often times as a developer you are subject to the requests
>> of those higher up and you end up with 30 facets of strings that are the
>> length of names.  But yes, test as low as you can and try to keep the
>> qtimes low and just keep adjusting until you are happy with whatever time
>> works for you, I preferred sub half second but the index was 400+ gb so I
>> used a large heap
>>> 
>>>> On Mar 9, 2023, at 7:56 AM, Jan Høydahl <ja...@cominvent.com> wrote:
>>>> 
>>>> It's a waste to set heap to 30g if your use of Solr only requires 6g
>> to function. That is 24G memory not being used for index caching, and it
>> will may, depending on chose GC, cause bigger/longer GC events as more
>> garbage piles up before collection.
>>>> 
>>>> You have to measure and experiment to find your heap sweetspot.
>>>> It is a common misconception that giving more heap to Solr improves
>> performance of something, it's rather the contrary. Only rarely do you need
>> huge internal solr caches, and if you find yourself needing that kind of
>> memory due to requesting huge number of docs or faceting on high
>> cardinality long string fields or whatever, then it is better to optimize
>> your use of Solr to lower the footprint than to add >30g.
>>>> 
>>>> Jan
>>>> 
>>>>> 9. mar. 2023 kl. 12:52 skrev Dave <ha...@gmail.com>:
>>>>> 
>>>>> Again, set to less than 32, I liked 30
>>>>> 
>>>>>>> On Mar 9, 2023, at 1:04 AM, Deepak Goel <de...@gmail.com> wrote:
>>>>>> 
>>>>>> The max heap could be the max heap used by the process uptill now.
>> And not
>>>>>> the max value you have set. I would suggest you increase the load by
>> at
>>>>>> least 20 times to see the max heap to go to 32 gb.
>>>>>> 
>>>>>> 
>>>>>> Deepak
>>>>>> "The greatness of a nation can be judged by the way its animals are
>> treated
>>>>>> - Mahatma Gandhi"
>>>>>> 
>>>>>> +91 73500 12833
>>>>>> deicool@gmail.com
>>>>>> 
>>>>>> Facebook: https://www.facebook.com/deicool
>>>>>> LinkedIn: www.linkedin.com/in/deicool
>>>>>> 
>>>>>> "Plant a Tree, Go Green"
>>>>>> 
>>>>>> Make In India : http://www.makeinindia.com/home
>>>>>> 
>>>>>> 
>>>>>>> On Thu, Mar 9, 2023 at 8:21 AM Shawn Heisey <ap...@elyograg.org>
>> wrote:
>>>>>>> 
>>>>>>>> On 3/8/2023 9:24 AM, HariBabu kuruva wrote:
>>>>>>>> I have set the Heap memory as -Xms 1g -Xmx 40g in the Production
>>>>>>>> environment.
>>>>>>>> 
>>>>>>>> But when i see the Heap memory in the Solr UI. I can see the Max
>> Heap
>>>>>>> below.
>>>>>>>> 
>>>>>>>> Max: 3.8Gb
>>>>>>>> Used: 2.2Gb
>>>>>>> 
>>>>>>> The other answers you've gotten are good.  This is mostly just a
>> little
>>>>>>> more detail.
>>>>>>> 
>>>>>>> If you really do have the spaces before the 1g and 40g, then those
>>>>>>> values are probably not being honored as Jan said.
>>>>>>> 
>>>>>>> If you don't have the spaces, then Java will start with the heap
>> size at
>>>>>>> 1GB, and only increase it if there is enough memory pressure.  One
>> thing
>>>>>>> that I don't know is whether Java will use the 32 bit pointers with
>> the
>>>>>>> Xmx at 40g.  It probably won't, so I expect that memory usage would
>> be
>>>>>>> more efficient if you set the max heap to 31g.
>>>>>>> 
>>>>>>> With a heap size at 32GB or larger, Java has to use 64 bit pointers,
>> and
>>>>>>> that will make it use quite a bit more memory because Solr creates a
>> LOT
>>>>>>> of objects.
>>>>>>> 
>>>>>>> As Dave said, if you use Xms and Xmx, then they should be set to the
>>>>>>> same value.  And the value should be less than 32GB for efficiency.
>>>>>>> 
>>>>>>> If you use the SOLR_HEAP environment variable in the include script,
>>>>>>> then both Xms and Xmx will be set to the provided value.
>>>>>>> 
>>>>>>> Thanks,
>>>>>>> Shawn
>>>>>>> 
>>>> 
>> 
>> 
> 
> -- 
> 
> Thanks and Regards,
> Hari
> Mobile:9790756568

Re: Solr Heap Memory Settings

Posted by Jan Høydahl <ja...@cominvent.com>.
It may sound counter intuitive, but allocate as little Java heap as possible to Solr, without causing OOM. Read up on the reference guide links provided as well as excellent advice on profiling your heap usage.

Jan Høydahl

> 14. mar. 2023 kl. 15:03 skrev HariBabu kuruva <ha...@gmail.com>:
> 
> Hi ,
> 
> Till now it was running with 45GB heap memory. I am trying to tune the
> performance of solr by adjusting heap memory.
> 
> So, I am looking for your inputs.
> 
>> On Tue, Mar 14, 2023 at 3:23 PM Jan Høydahl <ja...@cominvent.com> wrote:
>> 
>> Why do you believe you need such a huge heap as 31g? Can you support such
>> a choice by some observations or measurements?
>> 
>> Jan
>> 
>>> 14. mar. 2023 kl. 06:39 skrev HariBabu kuruva <hari2708.kuruva@gmail.com
>>> :
>>> 
>>> Thank you all for your responses.
>>> 
>>> There are no spaces between Xms and the values.
>>> 
>>> I have updated similar arguments(-Xms30720m -Xmx30720m) in one of the
>>> non-prod environments(in mbs instead of gb). It correctly shows the max
>>> heap as 30GB in the Solr UI.
>>> 
>>> So, I would like to update 31.5 GB similarly in PROD (-Xms32256m
>>> -Xmx32256m). Before applying that should i analyze heap memory stats
>> using
>>> Heap analyzer tool or i can go ahead and apply. I have a total server
>>> memory of 62GB and only solr is running in it. Please suggest.
>>> 
>>> 
>>> On Thu, Mar 9, 2023 at 8:00 PM Walter Underwood <wu...@wunderwood.org>
>>> wrote:
>>> 
>>>> Use a heap analysis tool. You’ll see a sawtooth pattern in the heap
>> size.
>>>> The bottom of that sawtooth is the actual amount of memory that Solr is
>>>> using. Pick the highest point of the bottom of the sawtooth, then add
>> some
>>>> headroom, maybe a gigabyte. Test with that value.
>>>> 
>>>> wunder
>>>> Walter Underwood
>>>> wunder@wunderwood.org
>>>> https://observer.wunderwood.org/ (my blog)
>>>> 
>>>>> On Mar 9, 2023, at 5:23 AM, Dave <ha...@gmail.com> wrote:
>>>>> 
>>>>> Agreed, but often times as a developer you are subject to the requests
>>>> of those higher up and you end up with 30 facets of strings that are the
>>>> length of names.  But yes, test as low as you can and try to keep the
>>>> qtimes low and just keep adjusting until you are happy with whatever
>> time
>>>> works for you, I preferred sub half second but the index was 400+ gb so
>> I
>>>> used a large heap
>>>>> 
>>>>>> On Mar 9, 2023, at 7:56 AM, Jan Høydahl <ja...@cominvent.com>
>> wrote:
>>>>>> 
>>>>>> It's a waste to set heap to 30g if your use of Solr only requires 6g
>>>> to function. That is 24G memory not being used for index caching, and it
>>>> will may, depending on chose GC, cause bigger/longer GC events as more
>>>> garbage piles up before collection.
>>>>>> 
>>>>>> You have to measure and experiment to find your heap sweetspot.
>>>>>> It is a common misconception that giving more heap to Solr improves
>>>> performance of something, it's rather the contrary. Only rarely do you
>> need
>>>> huge internal solr caches, and if you find yourself needing that kind of
>>>> memory due to requesting huge number of docs or faceting on high
>>>> cardinality long string fields or whatever, then it is better to
>> optimize
>>>> your use of Solr to lower the footprint than to add >30g.
>>>>>> 
>>>>>> Jan
>>>>>> 
>>>>>>> 9. mar. 2023 kl. 12:52 skrev Dave <ha...@gmail.com>:
>>>>>>> 
>>>>>>> Again, set to less than 32, I liked 30
>>>>>>> 
>>>>>>>>> On Mar 9, 2023, at 1:04 AM, Deepak Goel <de...@gmail.com> wrote:
>>>>>>>> 
>>>>>>>> The max heap could be the max heap used by the process uptill now.
>>>> And not
>>>>>>>> the max value you have set. I would suggest you increase the load by
>>>> at
>>>>>>>> least 20 times to see the max heap to go to 32 gb.
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Deepak
>>>>>>>> "The greatness of a nation can be judged by the way its animals are
>>>> treated
>>>>>>>> - Mahatma Gandhi"
>>>>>>>> 
>>>>>>>> +91 73500 12833
>>>>>>>> deicool@gmail.com
>>>>>>>> 
>>>>>>>> Facebook: https://www.facebook.com/deicool
>>>>>>>> LinkedIn: www.linkedin.com/in/deicool
>>>>>>>> 
>>>>>>>> "Plant a Tree, Go Green"
>>>>>>>> 
>>>>>>>> Make In India : http://www.makeinindia.com/home
>>>>>>>> 
>>>>>>>> 
>>>>>>>>> On Thu, Mar 9, 2023 at 8:21 AM Shawn Heisey <ap...@elyograg.org>
>>>> wrote:
>>>>>>>>> 
>>>>>>>>>> On 3/8/2023 9:24 AM, HariBabu kuruva wrote:
>>>>>>>>>> I have set the Heap memory as -Xms 1g -Xmx 40g in the Production
>>>>>>>>>> environment.
>>>>>>>>>> 
>>>>>>>>>> But when i see the Heap memory in the Solr UI. I can see the Max
>>>> Heap
>>>>>>>>> below.
>>>>>>>>>> 
>>>>>>>>>> Max: 3.8Gb
>>>>>>>>>> Used: 2.2Gb
>>>>>>>>> 
>>>>>>>>> The other answers you've gotten are good.  This is mostly just a
>>>> little
>>>>>>>>> more detail.
>>>>>>>>> 
>>>>>>>>> If you really do have the spaces before the 1g and 40g, then those
>>>>>>>>> values are probably not being honored as Jan said.
>>>>>>>>> 
>>>>>>>>> If you don't have the spaces, then Java will start with the heap
>>>> size at
>>>>>>>>> 1GB, and only increase it if there is enough memory pressure.  One
>>>> thing
>>>>>>>>> that I don't know is whether Java will use the 32 bit pointers with
>>>> the
>>>>>>>>> Xmx at 40g.  It probably won't, so I expect that memory usage would
>>>> be
>>>>>>>>> more efficient if you set the max heap to 31g.
>>>>>>>>> 
>>>>>>>>> With a heap size at 32GB or larger, Java has to use 64 bit
>> pointers,
>>>> and
>>>>>>>>> that will make it use quite a bit more memory because Solr creates
>> a
>>>> LOT
>>>>>>>>> of objects.
>>>>>>>>> 
>>>>>>>>> As Dave said, if you use Xms and Xmx, then they should be set to
>> the
>>>>>>>>> same value.  And the value should be less than 32GB for efficiency.
>>>>>>>>> 
>>>>>>>>> If you use the SOLR_HEAP environment variable in the include
>> script,
>>>>>>>>> then both Xms and Xmx will be set to the provided value.
>>>>>>>>> 
>>>>>>>>> Thanks,
>>>>>>>>> Shawn
>>>>>>>>> 
>>>>>> 
>>>> 
>>>> 
>>> 
>>> --
>>> 
>>> Thanks and Regards,
>>> Hari
>>> Mobile:9790756568
>> 
>> 
> 
> -- 
> 
> Thanks and Regards,
> Hari
> Mobile:9790756568

Re: Solr Heap Memory Settings

Posted by Shawn Heisey <ap...@elyograg.org>.
On 3/15/23 06:35, Mark H. Wood wrote:
> I'm always flummoxed by this question:  what is the total index size?
> 
> It's easy to get 'numDocs' from the admin. interface, but there's
> nothing I can find there that I would interpret as "index size".
> 
> Does this mean the sum of sizes of all files in $CORE/data/index?  Can
> I just report the output of 'du $CORE/data/index'?  We have a lot of
> sizable 'stored' fields, and I suspect that those data are not to be
> included.
> 
> IOW when someone asks me for the total index size of a Solr instance,
> how should I calculate it?

The size of a core is shown in the admin UI when you choose the core 
from the dropdown.  Add up all the values you find there to get the total.

To get the total all at once from the commandline, do:

du -hsc ${solr.solr.home}/*/data/index

The solr home is the directory where all your cores live.  If you have 
defined the solr data home, you should use that instead of the solr home.

Thanks,
Shawn

Re: Solr Heap Memory Settings

Posted by Bernd Fehling <be...@uni-bielefeld.de>.
At Solr Admin Web Interface I click on "Core Collector" and
select one of the shards.
My maxDocs says 33.972.375 and below the size reports 112.5GB.
Because of 10 shards in my cloud just multiply by 10 which gives
a rough estimate ~340.000.000 Docs and ~1.125TB size.

To calculate growth just take 112.5GB / 33.972.375 which makes ~3.3KB per doc (indexed).

Regards
Bernd

Am 15.03.23 um 13:35 schrieb Mark H. Wood:
> On Tue, Mar 14, 2023 at 08:21:26AM -0600, Shawn Heisey wrote:
>> On 3/14/23 08:01, HariBabu kuruva wrote:
>>> Till now it was running with 45GB heap memory. I am trying to tune the
>>> performance of solr by adjusting heap memory.
>>
>> What is the total index size and total doc count of the server?
> 
> I'm always flummoxed by this question:  what is the total index size?
> 
> It's easy to get 'numDocs' from the admin. interface, but there's
> nothing I can find there that I would interpret as "index size".
> 
> Does this mean the sum of sizes of all files in $CORE/data/index?  Can
> I just report the output of 'du $CORE/data/index'?  We have a lot of
> sizable 'stored' fields, and I suspect that those data are not to be
> included.
> 
> IOW when someone asks me for the total index size of a Solr instance,
> how should I calculate it?
> 


Re: Solr Heap Memory Settings

Posted by "Mark H. Wood" <mw...@iupui.edu>.
On Tue, Mar 14, 2023 at 08:21:26AM -0600, Shawn Heisey wrote:
> On 3/14/23 08:01, HariBabu kuruva wrote:
> > Till now it was running with 45GB heap memory. I am trying to tune the
> > performance of solr by adjusting heap memory.
> 
> What is the total index size and total doc count of the server?

I'm always flummoxed by this question:  what is the total index size?

It's easy to get 'numDocs' from the admin. interface, but there's
nothing I can find there that I would interpret as "index size".

Does this mean the sum of sizes of all files in $CORE/data/index?  Can
I just report the output of 'du $CORE/data/index'?  We have a lot of
sizable 'stored' fields, and I suspect that those data are not to be
included.

IOW when someone asks me for the total index size of a Solr instance,
how should I calculate it?

-- 
Mark H. Wood
Lead Technology Analyst

University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu

Re: Solr Heap Memory Settings

Posted by Shawn Heisey <el...@elyograg.org>.
On 3/14/23 08:01, HariBabu kuruva wrote:
> Till now it was running with 45GB heap memory. I am trying to tune the
> performance of solr by adjusting heap memory.

What is the total index size and total doc count of the server?

In the past I have run Solr servers with 80 million documents across 3 
cores taking up over 100GB of disk space (can't remember the exact size) 
with the max heap set to 8GB.

Unless your index is REALLY huge, I cannot imagine it needing a heap 
size of 31GB or more.  Do you have any evidence that the heap actually 
needs to be that big?

If you provide some GC logs from Solr, they can be analyzed at 
https://gceasy.io to determine whether you really need a heap that big. 
Note that you should not send them as email attachments because the 
mailing list will most likely eat them so we never see them.

Thanks,
Shawn

Re: Solr Heap Memory Settings

Posted by Walter Underwood <wu...@wunderwood.org>.
Do what I suggested a few days ago. That is how you find out how much heap the system really needs.

Use a heap analysis tool. You’ll see a sawtooth pattern in the heap size. The bottom of that sawtooth is the actual amount of memory that Solr is using. Pick the highest point of the bottom of the sawtooth, then add some headroom, maybe a gigabyte. Test with that value.

wunder
Walter Underwood
wunder@wunderwood.org
http://observer.wunderwood.org/  (my blog)

> On Mar 14, 2023, at 7:01 AM, HariBabu kuruva <ha...@gmail.com> wrote:
> 
> Hi ,
> 
> Till now it was running with 45GB heap memory. I am trying to tune the
> performance of solr by adjusting heap memory.
> 
> So, I am looking for your inputs.
> 
> On Tue, Mar 14, 2023 at 3:23 PM Jan Høydahl <ja...@cominvent.com> wrote:
> 
>> Why do you believe you need such a huge heap as 31g? Can you support such
>> a choice by some observations or measurements?
>> 
>> Jan
>> 
>>> 14. mar. 2023 kl. 06:39 skrev HariBabu kuruva <hari2708.kuruva@gmail.com
>>> :
>>> 
>>> Thank you all for your responses.
>>> 
>>> There are no spaces between Xms and the values.
>>> 
>>> I have updated similar arguments(-Xms30720m -Xmx30720m) in one of the
>>> non-prod environments(in mbs instead of gb). It correctly shows the max
>>> heap as 30GB in the Solr UI.
>>> 
>>> So, I would like to update 31.5 GB similarly in PROD (-Xms32256m
>>> -Xmx32256m). Before applying that should i analyze heap memory stats
>> using
>>> Heap analyzer tool or i can go ahead and apply. I have a total server
>>> memory of 62GB and only solr is running in it. Please suggest.
>>> 
>>> 
>>> On Thu, Mar 9, 2023 at 8:00 PM Walter Underwood <wu...@wunderwood.org>
>>> wrote:
>>> 
>>>> Use a heap analysis tool. You’ll see a sawtooth pattern in the heap
>> size.
>>>> The bottom of that sawtooth is the actual amount of memory that Solr is
>>>> using. Pick the highest point of the bottom of the sawtooth, then add
>> some
>>>> headroom, maybe a gigabyte. Test with that value.
>>>> 
>>>> wunder
>>>> Walter Underwood
>>>> wunder@wunderwood.org
>>>> https://observer.wunderwood.org/ (my blog)
>>>> 
>>>>> On Mar 9, 2023, at 5:23 AM, Dave <ha...@gmail.com> wrote:
>>>>> 
>>>>> Agreed, but often times as a developer you are subject to the requests
>>>> of those higher up and you end up with 30 facets of strings that are the
>>>> length of names.  But yes, test as low as you can and try to keep the
>>>> qtimes low and just keep adjusting until you are happy with whatever
>> time
>>>> works for you, I preferred sub half second but the index was 400+ gb so
>> I
>>>> used a large heap
>>>>> 
>>>>>> On Mar 9, 2023, at 7:56 AM, Jan Høydahl <ja...@cominvent.com>
>> wrote:
>>>>>> 
>>>>>> It's a waste to set heap to 30g if your use of Solr only requires 6g
>>>> to function. That is 24G memory not being used for index caching, and it
>>>> will may, depending on chose GC, cause bigger/longer GC events as more
>>>> garbage piles up before collection.
>>>>>> 
>>>>>> You have to measure and experiment to find your heap sweetspot.
>>>>>> It is a common misconception that giving more heap to Solr improves
>>>> performance of something, it's rather the contrary. Only rarely do you
>> need
>>>> huge internal solr caches, and if you find yourself needing that kind of
>>>> memory due to requesting huge number of docs or faceting on high
>>>> cardinality long string fields or whatever, then it is better to
>> optimize
>>>> your use of Solr to lower the footprint than to add >30g.
>>>>>> 
>>>>>> Jan
>>>>>> 
>>>>>>> 9. mar. 2023 kl. 12:52 skrev Dave <ha...@gmail.com>:
>>>>>>> 
>>>>>>> Again, set to less than 32, I liked 30
>>>>>>> 
>>>>>>>>> On Mar 9, 2023, at 1:04 AM, Deepak Goel <de...@gmail.com> wrote:
>>>>>>>> 
>>>>>>>> The max heap could be the max heap used by the process uptill now.
>>>> And not
>>>>>>>> the max value you have set. I would suggest you increase the load by
>>>> at
>>>>>>>> least 20 times to see the max heap to go to 32 gb.
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Deepak
>>>>>>>> "The greatness of a nation can be judged by the way its animals are
>>>> treated
>>>>>>>> - Mahatma Gandhi"
>>>>>>>> 
>>>>>>>> +91 73500 12833
>>>>>>>> deicool@gmail.com
>>>>>>>> 
>>>>>>>> Facebook: https://www.facebook.com/deicool
>>>>>>>> LinkedIn: www.linkedin.com/in/deicool
>>>>>>>> 
>>>>>>>> "Plant a Tree, Go Green"
>>>>>>>> 
>>>>>>>> Make In India : http://www.makeinindia.com/home
>>>>>>>> 
>>>>>>>> 
>>>>>>>>> On Thu, Mar 9, 2023 at 8:21 AM Shawn Heisey <ap...@elyograg.org>
>>>> wrote:
>>>>>>>>> 
>>>>>>>>>> On 3/8/2023 9:24 AM, HariBabu kuruva wrote:
>>>>>>>>>> I have set the Heap memory as -Xms 1g -Xmx 40g in the Production
>>>>>>>>>> environment.
>>>>>>>>>> 
>>>>>>>>>> But when i see the Heap memory in the Solr UI. I can see the Max
>>>> Heap
>>>>>>>>> below.
>>>>>>>>>> 
>>>>>>>>>> Max: 3.8Gb
>>>>>>>>>> Used: 2.2Gb
>>>>>>>>> 
>>>>>>>>> The other answers you've gotten are good.  This is mostly just a
>>>> little
>>>>>>>>> more detail.
>>>>>>>>> 
>>>>>>>>> If you really do have the spaces before the 1g and 40g, then those
>>>>>>>>> values are probably not being honored as Jan said.
>>>>>>>>> 
>>>>>>>>> If you don't have the spaces, then Java will start with the heap
>>>> size at
>>>>>>>>> 1GB, and only increase it if there is enough memory pressure.  One
>>>> thing
>>>>>>>>> that I don't know is whether Java will use the 32 bit pointers with
>>>> the
>>>>>>>>> Xmx at 40g.  It probably won't, so I expect that memory usage would
>>>> be
>>>>>>>>> more efficient if you set the max heap to 31g.
>>>>>>>>> 
>>>>>>>>> With a heap size at 32GB or larger, Java has to use 64 bit
>> pointers,
>>>> and
>>>>>>>>> that will make it use quite a bit more memory because Solr creates
>> a
>>>> LOT
>>>>>>>>> of objects.
>>>>>>>>> 
>>>>>>>>> As Dave said, if you use Xms and Xmx, then they should be set to
>> the
>>>>>>>>> same value.  And the value should be less than 32GB for efficiency.
>>>>>>>>> 
>>>>>>>>> If you use the SOLR_HEAP environment variable in the include
>> script,
>>>>>>>>> then both Xms and Xmx will be set to the provided value.
>>>>>>>>> 
>>>>>>>>> Thanks,
>>>>>>>>> Shawn
>>>>>>>>> 
>>>>>> 
>>>> 
>>>> 
>>> 
>>> --
>>> 
>>> Thanks and Regards,
>>> Hari
>>> Mobile:9790756568
>> 
>> 
> 
> -- 
> 
> Thanks and Regards,
> Hari
> Mobile:9790756568


Re: Solr Heap Memory Settings

Posted by HariBabu kuruva <ha...@gmail.com>.
Hi ,

Till now it was running with 45GB heap memory. I am trying to tune the
performance of solr by adjusting heap memory.

So, I am looking for your inputs.

On Tue, Mar 14, 2023 at 3:23 PM Jan Høydahl <ja...@cominvent.com> wrote:

> Why do you believe you need such a huge heap as 31g? Can you support such
> a choice by some observations or measurements?
>
> Jan
>
> > 14. mar. 2023 kl. 06:39 skrev HariBabu kuruva <hari2708.kuruva@gmail.com
> >:
> >
> > Thank you all for your responses.
> >
> > There are no spaces between Xms and the values.
> >
> > I have updated similar arguments(-Xms30720m -Xmx30720m) in one of the
> > non-prod environments(in mbs instead of gb). It correctly shows the max
> > heap as 30GB in the Solr UI.
> >
> > So, I would like to update 31.5 GB similarly in PROD (-Xms32256m
> > -Xmx32256m). Before applying that should i analyze heap memory stats
> using
> > Heap analyzer tool or i can go ahead and apply. I have a total server
> > memory of 62GB and only solr is running in it. Please suggest.
> >
> >
> > On Thu, Mar 9, 2023 at 8:00 PM Walter Underwood <wu...@wunderwood.org>
> > wrote:
> >
> >> Use a heap analysis tool. You’ll see a sawtooth pattern in the heap
> size.
> >> The bottom of that sawtooth is the actual amount of memory that Solr is
> >> using. Pick the highest point of the bottom of the sawtooth, then add
> some
> >> headroom, maybe a gigabyte. Test with that value.
> >>
> >> wunder
> >> Walter Underwood
> >> wunder@wunderwood.org
> >> https://observer.wunderwood.org/ (my blog)
> >>
> >>> On Mar 9, 2023, at 5:23 AM, Dave <ha...@gmail.com> wrote:
> >>>
> >>> Agreed, but often times as a developer you are subject to the requests
> >> of those higher up and you end up with 30 facets of strings that are the
> >> length of names.  But yes, test as low as you can and try to keep the
> >> qtimes low and just keep adjusting until you are happy with whatever
> time
> >> works for you, I preferred sub half second but the index was 400+ gb so
> I
> >> used a large heap
> >>>
> >>>> On Mar 9, 2023, at 7:56 AM, Jan Høydahl <ja...@cominvent.com>
> wrote:
> >>>>
> >>>> It's a waste to set heap to 30g if your use of Solr only requires 6g
> >> to function. That is 24G memory not being used for index caching, and it
> >> will may, depending on chose GC, cause bigger/longer GC events as more
> >> garbage piles up before collection.
> >>>>
> >>>> You have to measure and experiment to find your heap sweetspot.
> >>>> It is a common misconception that giving more heap to Solr improves
> >> performance of something, it's rather the contrary. Only rarely do you
> need
> >> huge internal solr caches, and if you find yourself needing that kind of
> >> memory due to requesting huge number of docs or faceting on high
> >> cardinality long string fields or whatever, then it is better to
> optimize
> >> your use of Solr to lower the footprint than to add >30g.
> >>>>
> >>>> Jan
> >>>>
> >>>>> 9. mar. 2023 kl. 12:52 skrev Dave <ha...@gmail.com>:
> >>>>>
> >>>>> Again, set to less than 32, I liked 30
> >>>>>
> >>>>>>> On Mar 9, 2023, at 1:04 AM, Deepak Goel <de...@gmail.com> wrote:
> >>>>>>
> >>>>>> The max heap could be the max heap used by the process uptill now.
> >> And not
> >>>>>> the max value you have set. I would suggest you increase the load by
> >> at
> >>>>>> least 20 times to see the max heap to go to 32 gb.
> >>>>>>
> >>>>>>
> >>>>>> Deepak
> >>>>>> "The greatness of a nation can be judged by the way its animals are
> >> treated
> >>>>>> - Mahatma Gandhi"
> >>>>>>
> >>>>>> +91 73500 12833
> >>>>>> deicool@gmail.com
> >>>>>>
> >>>>>> Facebook: https://www.facebook.com/deicool
> >>>>>> LinkedIn: www.linkedin.com/in/deicool
> >>>>>>
> >>>>>> "Plant a Tree, Go Green"
> >>>>>>
> >>>>>> Make In India : http://www.makeinindia.com/home
> >>>>>>
> >>>>>>
> >>>>>>> On Thu, Mar 9, 2023 at 8:21 AM Shawn Heisey <ap...@elyograg.org>
> >> wrote:
> >>>>>>>
> >>>>>>>> On 3/8/2023 9:24 AM, HariBabu kuruva wrote:
> >>>>>>>> I have set the Heap memory as -Xms 1g -Xmx 40g in the Production
> >>>>>>>> environment.
> >>>>>>>>
> >>>>>>>> But when i see the Heap memory in the Solr UI. I can see the Max
> >> Heap
> >>>>>>> below.
> >>>>>>>>
> >>>>>>>> Max: 3.8Gb
> >>>>>>>> Used: 2.2Gb
> >>>>>>>
> >>>>>>> The other answers you've gotten are good.  This is mostly just a
> >> little
> >>>>>>> more detail.
> >>>>>>>
> >>>>>>> If you really do have the spaces before the 1g and 40g, then those
> >>>>>>> values are probably not being honored as Jan said.
> >>>>>>>
> >>>>>>> If you don't have the spaces, then Java will start with the heap
> >> size at
> >>>>>>> 1GB, and only increase it if there is enough memory pressure.  One
> >> thing
> >>>>>>> that I don't know is whether Java will use the 32 bit pointers with
> >> the
> >>>>>>> Xmx at 40g.  It probably won't, so I expect that memory usage would
> >> be
> >>>>>>> more efficient if you set the max heap to 31g.
> >>>>>>>
> >>>>>>> With a heap size at 32GB or larger, Java has to use 64 bit
> pointers,
> >> and
> >>>>>>> that will make it use quite a bit more memory because Solr creates
> a
> >> LOT
> >>>>>>> of objects.
> >>>>>>>
> >>>>>>> As Dave said, if you use Xms and Xmx, then they should be set to
> the
> >>>>>>> same value.  And the value should be less than 32GB for efficiency.
> >>>>>>>
> >>>>>>> If you use the SOLR_HEAP environment variable in the include
> script,
> >>>>>>> then both Xms and Xmx will be set to the provided value.
> >>>>>>>
> >>>>>>> Thanks,
> >>>>>>> Shawn
> >>>>>>>
> >>>>
> >>
> >>
> >
> > --
> >
> > Thanks and Regards,
> > Hari
> > Mobile:9790756568
>
>

-- 

Thanks and Regards,
 Hari
Mobile:9790756568

Re: Solr Heap Memory Settings

Posted by Jan Høydahl <ja...@cominvent.com>.
Why do you believe you need such a huge heap as 31g? Can you support such a choice by some observations or measurements?

Jan

> 14. mar. 2023 kl. 06:39 skrev HariBabu kuruva <ha...@gmail.com>:
> 
> Thank you all for your responses.
> 
> There are no spaces between Xms and the values.
> 
> I have updated similar arguments(-Xms30720m -Xmx30720m) in one of the
> non-prod environments(in mbs instead of gb). It correctly shows the max
> heap as 30GB in the Solr UI.
> 
> So, I would like to update 31.5 GB similarly in PROD (-Xms32256m
> -Xmx32256m). Before applying that should i analyze heap memory stats using
> Heap analyzer tool or i can go ahead and apply. I have a total server
> memory of 62GB and only solr is running in it. Please suggest.
> 
> 
> On Thu, Mar 9, 2023 at 8:00 PM Walter Underwood <wu...@wunderwood.org>
> wrote:
> 
>> Use a heap analysis tool. You’ll see a sawtooth pattern in the heap size.
>> The bottom of that sawtooth is the actual amount of memory that Solr is
>> using. Pick the highest point of the bottom of the sawtooth, then add some
>> headroom, maybe a gigabyte. Test with that value.
>> 
>> wunder
>> Walter Underwood
>> wunder@wunderwood.org
>> https://observer.wunderwood.org/ (my blog)
>> 
>>> On Mar 9, 2023, at 5:23 AM, Dave <ha...@gmail.com> wrote:
>>> 
>>> Agreed, but often times as a developer you are subject to the requests
>> of those higher up and you end up with 30 facets of strings that are the
>> length of names.  But yes, test as low as you can and try to keep the
>> qtimes low and just keep adjusting until you are happy with whatever time
>> works for you, I preferred sub half second but the index was 400+ gb so I
>> used a large heap
>>> 
>>>> On Mar 9, 2023, at 7:56 AM, Jan Høydahl <ja...@cominvent.com> wrote:
>>>> 
>>>> It's a waste to set heap to 30g if your use of Solr only requires 6g
>> to function. That is 24G memory not being used for index caching, and it
>> will may, depending on chose GC, cause bigger/longer GC events as more
>> garbage piles up before collection.
>>>> 
>>>> You have to measure and experiment to find your heap sweetspot.
>>>> It is a common misconception that giving more heap to Solr improves
>> performance of something, it's rather the contrary. Only rarely do you need
>> huge internal solr caches, and if you find yourself needing that kind of
>> memory due to requesting huge number of docs or faceting on high
>> cardinality long string fields or whatever, then it is better to optimize
>> your use of Solr to lower the footprint than to add >30g.
>>>> 
>>>> Jan
>>>> 
>>>>> 9. mar. 2023 kl. 12:52 skrev Dave <ha...@gmail.com>:
>>>>> 
>>>>> Again, set to less than 32, I liked 30
>>>>> 
>>>>>>> On Mar 9, 2023, at 1:04 AM, Deepak Goel <de...@gmail.com> wrote:
>>>>>> 
>>>>>> The max heap could be the max heap used by the process uptill now.
>> And not
>>>>>> the max value you have set. I would suggest you increase the load by
>> at
>>>>>> least 20 times to see the max heap to go to 32 gb.
>>>>>> 
>>>>>> 
>>>>>> Deepak
>>>>>> "The greatness of a nation can be judged by the way its animals are
>> treated
>>>>>> - Mahatma Gandhi"
>>>>>> 
>>>>>> +91 73500 12833
>>>>>> deicool@gmail.com
>>>>>> 
>>>>>> Facebook: https://www.facebook.com/deicool
>>>>>> LinkedIn: www.linkedin.com/in/deicool
>>>>>> 
>>>>>> "Plant a Tree, Go Green"
>>>>>> 
>>>>>> Make In India : http://www.makeinindia.com/home
>>>>>> 
>>>>>> 
>>>>>>> On Thu, Mar 9, 2023 at 8:21 AM Shawn Heisey <ap...@elyograg.org>
>> wrote:
>>>>>>> 
>>>>>>>> On 3/8/2023 9:24 AM, HariBabu kuruva wrote:
>>>>>>>> I have set the Heap memory as -Xms 1g -Xmx 40g in the Production
>>>>>>>> environment.
>>>>>>>> 
>>>>>>>> But when i see the Heap memory in the Solr UI. I can see the Max
>> Heap
>>>>>>> below.
>>>>>>>> 
>>>>>>>> Max: 3.8Gb
>>>>>>>> Used: 2.2Gb
>>>>>>> 
>>>>>>> The other answers you've gotten are good.  This is mostly just a
>> little
>>>>>>> more detail.
>>>>>>> 
>>>>>>> If you really do have the spaces before the 1g and 40g, then those
>>>>>>> values are probably not being honored as Jan said.
>>>>>>> 
>>>>>>> If you don't have the spaces, then Java will start with the heap
>> size at
>>>>>>> 1GB, and only increase it if there is enough memory pressure.  One
>> thing
>>>>>>> that I don't know is whether Java will use the 32 bit pointers with
>> the
>>>>>>> Xmx at 40g.  It probably won't, so I expect that memory usage would
>> be
>>>>>>> more efficient if you set the max heap to 31g.
>>>>>>> 
>>>>>>> With a heap size at 32GB or larger, Java has to use 64 bit pointers,
>> and
>>>>>>> that will make it use quite a bit more memory because Solr creates a
>> LOT
>>>>>>> of objects.
>>>>>>> 
>>>>>>> As Dave said, if you use Xms and Xmx, then they should be set to the
>>>>>>> same value.  And the value should be less than 32GB for efficiency.
>>>>>>> 
>>>>>>> If you use the SOLR_HEAP environment variable in the include script,
>>>>>>> then both Xms and Xmx will be set to the provided value.
>>>>>>> 
>>>>>>> Thanks,
>>>>>>> Shawn
>>>>>>> 
>>>> 
>> 
>> 
> 
> -- 
> 
> Thanks and Regards,
> Hari
> Mobile:9790756568


Re: Solr Heap Memory Settings

Posted by HariBabu kuruva <ha...@gmail.com>.
Thank you all for your responses.

There are no spaces between Xms and the values.

I have updated similar arguments(-Xms30720m -Xmx30720m) in one of the
non-prod environments(in mbs instead of gb). It correctly shows the max
heap as 30GB in the Solr UI.

So, I would like to update 31.5 GB similarly in PROD (-Xms32256m
-Xmx32256m). Before applying that should i analyze heap memory stats using
Heap analyzer tool or i can go ahead and apply. I have a total server
memory of 62GB and only solr is running in it. Please suggest.


On Thu, Mar 9, 2023 at 8:00 PM Walter Underwood <wu...@wunderwood.org>
wrote:

> Use a heap analysis tool. You’ll see a sawtooth pattern in the heap size.
> The bottom of that sawtooth is the actual amount of memory that Solr is
> using. Pick the highest point of the bottom of the sawtooth, then add some
> headroom, maybe a gigabyte. Test with that value.
>
> wunder
> Walter Underwood
> wunder@wunderwood.org
> https://observer.wunderwood.org/ (my blog)
>
> > On Mar 9, 2023, at 5:23 AM, Dave <ha...@gmail.com> wrote:
> >
> > Agreed, but often times as a developer you are subject to the requests
> of those higher up and you end up with 30 facets of strings that are the
> length of names.  But yes, test as low as you can and try to keep the
> qtimes low and just keep adjusting until you are happy with whatever time
> works for you, I preferred sub half second but the index was 400+ gb so I
> used a large heap
> >
> >> On Mar 9, 2023, at 7:56 AM, Jan Høydahl <ja...@cominvent.com> wrote:
> >>
> >> It's a waste to set heap to 30g if your use of Solr only requires 6g
> to function. That is 24G memory not being used for index caching, and it
> will may, depending on chose GC, cause bigger/longer GC events as more
> garbage piles up before collection.
> >>
> >> You have to measure and experiment to find your heap sweetspot.
> >> It is a common misconception that giving more heap to Solr improves
> performance of something, it's rather the contrary. Only rarely do you need
> huge internal solr caches, and if you find yourself needing that kind of
> memory due to requesting huge number of docs or faceting on high
> cardinality long string fields or whatever, then it is better to optimize
> your use of Solr to lower the footprint than to add >30g.
> >>
> >> Jan
> >>
> >>> 9. mar. 2023 kl. 12:52 skrev Dave <ha...@gmail.com>:
> >>>
> >>> Again, set to less than 32, I liked 30
> >>>
> >>>>> On Mar 9, 2023, at 1:04 AM, Deepak Goel <de...@gmail.com> wrote:
> >>>>
> >>>> The max heap could be the max heap used by the process uptill now.
> And not
> >>>> the max value you have set. I would suggest you increase the load by
> at
> >>>> least 20 times to see the max heap to go to 32 gb.
> >>>>
> >>>>
> >>>> Deepak
> >>>> "The greatness of a nation can be judged by the way its animals are
> treated
> >>>> - Mahatma Gandhi"
> >>>>
> >>>> +91 73500 12833
> >>>> deicool@gmail.com
> >>>>
> >>>> Facebook: https://www.facebook.com/deicool
> >>>> LinkedIn: www.linkedin.com/in/deicool
> >>>>
> >>>> "Plant a Tree, Go Green"
> >>>>
> >>>> Make In India : http://www.makeinindia.com/home
> >>>>
> >>>>
> >>>>> On Thu, Mar 9, 2023 at 8:21 AM Shawn Heisey <ap...@elyograg.org>
> wrote:
> >>>>>
> >>>>>> On 3/8/2023 9:24 AM, HariBabu kuruva wrote:
> >>>>>> I have set the Heap memory as -Xms 1g -Xmx 40g in the Production
> >>>>>> environment.
> >>>>>>
> >>>>>> But when i see the Heap memory in the Solr UI. I can see the Max
> Heap
> >>>>> below.
> >>>>>>
> >>>>>> Max: 3.8Gb
> >>>>>> Used: 2.2Gb
> >>>>>
> >>>>> The other answers you've gotten are good.  This is mostly just a
> little
> >>>>> more detail.
> >>>>>
> >>>>> If you really do have the spaces before the 1g and 40g, then those
> >>>>> values are probably not being honored as Jan said.
> >>>>>
> >>>>> If you don't have the spaces, then Java will start with the heap
> size at
> >>>>> 1GB, and only increase it if there is enough memory pressure.  One
> thing
> >>>>> that I don't know is whether Java will use the 32 bit pointers with
> the
> >>>>> Xmx at 40g.  It probably won't, so I expect that memory usage would
> be
> >>>>> more efficient if you set the max heap to 31g.
> >>>>>
> >>>>> With a heap size at 32GB or larger, Java has to use 64 bit pointers,
> and
> >>>>> that will make it use quite a bit more memory because Solr creates a
> LOT
> >>>>> of objects.
> >>>>>
> >>>>> As Dave said, if you use Xms and Xmx, then they should be set to the
> >>>>> same value.  And the value should be less than 32GB for efficiency.
> >>>>>
> >>>>> If you use the SOLR_HEAP environment variable in the include script,
> >>>>> then both Xms and Xmx will be set to the provided value.
> >>>>>
> >>>>> Thanks,
> >>>>> Shawn
> >>>>>
> >>
>
>

-- 

Thanks and Regards,
 Hari
Mobile:9790756568

Re: Solr Heap Memory Settings

Posted by Walter Underwood <wu...@wunderwood.org>.
Use a heap analysis tool. You’ll see a sawtooth pattern in the heap size. The bottom of that sawtooth is the actual amount of memory that Solr is using. Pick the highest point of the bottom of the sawtooth, then add some headroom, maybe a gigabyte. Test with that value.

wunder
Walter Underwood
wunder@wunderwood.org
https://observer.wunderwood.org/ (my blog)

> On Mar 9, 2023, at 5:23 AM, Dave <ha...@gmail.com> wrote:
> 
> Agreed, but often times as a developer you are subject to the requests of those higher up and you end up with 30 facets of strings that are the length of names.  But yes, test as low as you can and try to keep the qtimes low and just keep adjusting until you are happy with whatever time works for you, I preferred sub half second but the index was 400+ gb so I used a large heap
> 
>> On Mar 9, 2023, at 7:56 AM, Jan Høydahl <ja...@cominvent.com> wrote:
>> 
>> It's a waste to set heap to 30g if your use of Solr only requires 6g to function. That is 24G memory not being used for index caching, and it will may, depending on chose GC, cause bigger/longer GC events as more garbage piles up before collection.
>> 
>> You have to measure and experiment to find your heap sweetspot.
>> It is a common misconception that giving more heap to Solr improves performance of something, it's rather the contrary. Only rarely do you need huge internal solr caches, and if you find yourself needing that kind of memory due to requesting huge number of docs or faceting on high cardinality long string fields or whatever, then it is better to optimize your use of Solr to lower the footprint than to add >30g.
>> 
>> Jan
>> 
>>> 9. mar. 2023 kl. 12:52 skrev Dave <ha...@gmail.com>:
>>> 
>>> Again, set to less than 32, I liked 30 
>>> 
>>>>> On Mar 9, 2023, at 1:04 AM, Deepak Goel <de...@gmail.com> wrote:
>>>> 
>>>> The max heap could be the max heap used by the process uptill now. And not
>>>> the max value you have set. I would suggest you increase the load by at
>>>> least 20 times to see the max heap to go to 32 gb.
>>>> 
>>>> 
>>>> Deepak
>>>> "The greatness of a nation can be judged by the way its animals are treated
>>>> - Mahatma Gandhi"
>>>> 
>>>> +91 73500 12833
>>>> deicool@gmail.com
>>>> 
>>>> Facebook: https://www.facebook.com/deicool
>>>> LinkedIn: www.linkedin.com/in/deicool
>>>> 
>>>> "Plant a Tree, Go Green"
>>>> 
>>>> Make In India : http://www.makeinindia.com/home
>>>> 
>>>> 
>>>>> On Thu, Mar 9, 2023 at 8:21 AM Shawn Heisey <ap...@elyograg.org> wrote:
>>>>> 
>>>>>> On 3/8/2023 9:24 AM, HariBabu kuruva wrote:
>>>>>> I have set the Heap memory as -Xms 1g -Xmx 40g in the Production
>>>>>> environment.
>>>>>> 
>>>>>> But when i see the Heap memory in the Solr UI. I can see the Max Heap
>>>>> below.
>>>>>> 
>>>>>> Max: 3.8Gb
>>>>>> Used: 2.2Gb
>>>>> 
>>>>> The other answers you've gotten are good.  This is mostly just a little
>>>>> more detail.
>>>>> 
>>>>> If you really do have the spaces before the 1g and 40g, then those
>>>>> values are probably not being honored as Jan said.
>>>>> 
>>>>> If you don't have the spaces, then Java will start with the heap size at
>>>>> 1GB, and only increase it if there is enough memory pressure.  One thing
>>>>> that I don't know is whether Java will use the 32 bit pointers with the
>>>>> Xmx at 40g.  It probably won't, so I expect that memory usage would be
>>>>> more efficient if you set the max heap to 31g.
>>>>> 
>>>>> With a heap size at 32GB or larger, Java has to use 64 bit pointers, and
>>>>> that will make it use quite a bit more memory because Solr creates a LOT
>>>>> of objects.
>>>>> 
>>>>> As Dave said, if you use Xms and Xmx, then they should be set to the
>>>>> same value.  And the value should be less than 32GB for efficiency.
>>>>> 
>>>>> If you use the SOLR_HEAP environment variable in the include script,
>>>>> then both Xms and Xmx will be set to the provided value.
>>>>> 
>>>>> Thanks,
>>>>> Shawn
>>>>> 
>> 


Re: Solr Heap Memory Settings

Posted by Dave <ha...@gmail.com>.
Agreed, but often times as a developer you are subject to the requests of those higher up and you end up with 30 facets of strings that are the length of names.  But yes, test as low as you can and try to keep the qtimes low and just keep adjusting until you are happy with whatever time works for you, I preferred sub half second but the index was 400+ gb so I used a large heap

> On Mar 9, 2023, at 7:56 AM, Jan Høydahl <ja...@cominvent.com> wrote:
> 
> It's a waste to set heap to 30g if your use of Solr only requires 6g to function. That is 24G memory not being used for index caching, and it will may, depending on chose GC, cause bigger/longer GC events as more garbage piles up before collection.
> 
> You have to measure and experiment to find your heap sweetspot.
> It is a common misconception that giving more heap to Solr improves performance of something, it's rather the contrary. Only rarely do you need huge internal solr caches, and if you find yourself needing that kind of memory due to requesting huge number of docs or faceting on high cardinality long string fields or whatever, then it is better to optimize your use of Solr to lower the footprint than to add >30g.
> 
> Jan
> 
>> 9. mar. 2023 kl. 12:52 skrev Dave <ha...@gmail.com>:
>> 
>> Again, set to less than 32, I liked 30 
>> 
>>>> On Mar 9, 2023, at 1:04 AM, Deepak Goel <de...@gmail.com> wrote:
>>> 
>>> The max heap could be the max heap used by the process uptill now. And not
>>> the max value you have set. I would suggest you increase the load by at
>>> least 20 times to see the max heap to go to 32 gb.
>>> 
>>> 
>>> Deepak
>>> "The greatness of a nation can be judged by the way its animals are treated
>>> - Mahatma Gandhi"
>>> 
>>> +91 73500 12833
>>> deicool@gmail.com
>>> 
>>> Facebook: https://www.facebook.com/deicool
>>> LinkedIn: www.linkedin.com/in/deicool
>>> 
>>> "Plant a Tree, Go Green"
>>> 
>>> Make In India : http://www.makeinindia.com/home
>>> 
>>> 
>>>> On Thu, Mar 9, 2023 at 8:21 AM Shawn Heisey <ap...@elyograg.org> wrote:
>>>> 
>>>>> On 3/8/2023 9:24 AM, HariBabu kuruva wrote:
>>>>> I have set the Heap memory as -Xms 1g -Xmx 40g in the Production
>>>>> environment.
>>>>> 
>>>>> But when i see the Heap memory in the Solr UI. I can see the Max Heap
>>>> below.
>>>>> 
>>>>> Max: 3.8Gb
>>>>> Used: 2.2Gb
>>>> 
>>>> The other answers you've gotten are good.  This is mostly just a little
>>>> more detail.
>>>> 
>>>> If you really do have the spaces before the 1g and 40g, then those
>>>> values are probably not being honored as Jan said.
>>>> 
>>>> If you don't have the spaces, then Java will start with the heap size at
>>>> 1GB, and only increase it if there is enough memory pressure.  One thing
>>>> that I don't know is whether Java will use the 32 bit pointers with the
>>>> Xmx at 40g.  It probably won't, so I expect that memory usage would be
>>>> more efficient if you set the max heap to 31g.
>>>> 
>>>> With a heap size at 32GB or larger, Java has to use 64 bit pointers, and
>>>> that will make it use quite a bit more memory because Solr creates a LOT
>>>> of objects.
>>>> 
>>>> As Dave said, if you use Xms and Xmx, then they should be set to the
>>>> same value.  And the value should be less than 32GB for efficiency.
>>>> 
>>>> If you use the SOLR_HEAP environment variable in the include script,
>>>> then both Xms and Xmx will be set to the provided value.
>>>> 
>>>> Thanks,
>>>> Shawn
>>>> 
> 

Re: Solr Heap Memory Settings

Posted by David Hastings <ha...@gmail.com>.
>    Set -Xms to "I know it wants at least this much".
>    Set -Xmx to significantly, but not wildly, more.


no, always set them to the same no matter what.  I like increments of 1024M
so I would start at 2048M and work up to 8gb and see how it performs.
Having a test script that forks to how many users at one given point you
are expecting helps a lot to see what is going to happen in the real
world.




On Thu, Mar 9, 2023 at 8:39 AM Mark H. Wood <mw...@iupui.edu> wrote:

> On Thu, Mar 09, 2023 at 01:56:11PM +0100, Jan Høydahl wrote:
> > It's a waste to set heap to 30g if your use of Solr only requires 6g to
> function. That is 24G memory not being used for index caching, and it will
> may, depending on chose GC, cause bigger/longer GC events as more garbage
> piles up before collection.
> >
> > You have to measure and experiment to find your heap sweetspot.
>
> Very sensible.
>
> It seems to me that there are two situations:
>
> 1  I don't know how much heap is right for my appllication:
>    Set -Xms to "I know it wants at least this much".
>    Set -Xmx to significantly, but not wildly, more.
>    Monitor performance.
>    If better than previous settings, set -Xms to -Xmx and increase -Xmx.
>    Repeat until performance is worse or the heap never expands beyond
>    -Xms.  If it got worse, then back off.
>    You are now in the second situation.
>
> 2  I know how much heap is right for my application:
>    Set -Xms = -Xmx = that much.
>    Continue to monitor, because workloads can change.
>
> Comments?
>
> --
> Mark H. Wood
> Lead Technology Analyst
>
> University Library
> Indiana University - Purdue University Indianapolis
> 755 W. Michigan Street
> Indianapolis, IN 46202
> 317-274-0749
> www.ulib.iupui.edu
>

Re: Solr Heap Memory Settings

Posted by "Mark H. Wood" <mw...@iupui.edu>.
On Thu, Mar 09, 2023 at 01:56:11PM +0100, Jan Høydahl wrote:
> It's a waste to set heap to 30g if your use of Solr only requires 6g to function. That is 24G memory not being used for index caching, and it will may, depending on chose GC, cause bigger/longer GC events as more garbage piles up before collection.
> 
> You have to measure and experiment to find your heap sweetspot.

Very sensible.

It seems to me that there are two situations:

1  I don't know how much heap is right for my appllication:
   Set -Xms to "I know it wants at least this much".
   Set -Xmx to significantly, but not wildly, more.
   Monitor performance.
   If better than previous settings, set -Xms to -Xmx and increase -Xmx.
   Repeat until performance is worse or the heap never expands beyond
   -Xms.  If it got worse, then back off.
   You are now in the second situation.

2  I know how much heap is right for my application:
   Set -Xms = -Xmx = that much.
   Continue to monitor, because workloads can change.

Comments?

-- 
Mark H. Wood
Lead Technology Analyst

University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu

Re: Solr Heap Memory Settings

Posted by Jan Høydahl <ja...@cominvent.com>.
It's a waste to set heap to 30g if your use of Solr only requires 6g to function. That is 24G memory not being used for index caching, and it will may, depending on chose GC, cause bigger/longer GC events as more garbage piles up before collection.

You have to measure and experiment to find your heap sweetspot.
It is a common misconception that giving more heap to Solr improves performance of something, it's rather the contrary. Only rarely do you need huge internal solr caches, and if you find yourself needing that kind of memory due to requesting huge number of docs or faceting on high cardinality long string fields or whatever, then it is better to optimize your use of Solr to lower the footprint than to add >30g.

Jan

> 9. mar. 2023 kl. 12:52 skrev Dave <ha...@gmail.com>:
> 
> Again, set to less than 32, I liked 30 
> 
>> On Mar 9, 2023, at 1:04 AM, Deepak Goel <de...@gmail.com> wrote:
>> 
>> The max heap could be the max heap used by the process uptill now. And not
>> the max value you have set. I would suggest you increase the load by at
>> least 20 times to see the max heap to go to 32 gb.
>> 
>> 
>> Deepak
>> "The greatness of a nation can be judged by the way its animals are treated
>> - Mahatma Gandhi"
>> 
>> +91 73500 12833
>> deicool@gmail.com
>> 
>> Facebook: https://www.facebook.com/deicool
>> LinkedIn: www.linkedin.com/in/deicool
>> 
>> "Plant a Tree, Go Green"
>> 
>> Make In India : http://www.makeinindia.com/home
>> 
>> 
>>> On Thu, Mar 9, 2023 at 8:21 AM Shawn Heisey <ap...@elyograg.org> wrote:
>>> 
>>>> On 3/8/2023 9:24 AM, HariBabu kuruva wrote:
>>>> I have set the Heap memory as -Xms 1g -Xmx 40g in the Production
>>>> environment.
>>>> 
>>>> But when i see the Heap memory in the Solr UI. I can see the Max Heap
>>> below.
>>>> 
>>>> Max: 3.8Gb
>>>> Used: 2.2Gb
>>> 
>>> The other answers you've gotten are good.  This is mostly just a little
>>> more detail.
>>> 
>>> If you really do have the spaces before the 1g and 40g, then those
>>> values are probably not being honored as Jan said.
>>> 
>>> If you don't have the spaces, then Java will start with the heap size at
>>> 1GB, and only increase it if there is enough memory pressure.  One thing
>>> that I don't know is whether Java will use the 32 bit pointers with the
>>> Xmx at 40g.  It probably won't, so I expect that memory usage would be
>>> more efficient if you set the max heap to 31g.
>>> 
>>> With a heap size at 32GB or larger, Java has to use 64 bit pointers, and
>>> that will make it use quite a bit more memory because Solr creates a LOT
>>> of objects.
>>> 
>>> As Dave said, if you use Xms and Xmx, then they should be set to the
>>> same value.  And the value should be less than 32GB for efficiency.
>>> 
>>> If you use the SOLR_HEAP environment variable in the include script,
>>> then both Xms and Xmx will be set to the provided value.
>>> 
>>> Thanks,
>>> Shawn
>>> 


Re: Solr Heap Memory Settings

Posted by Dave <ha...@gmail.com>.
Again, set to less than 32, I liked 30 

> On Mar 9, 2023, at 1:04 AM, Deepak Goel <de...@gmail.com> wrote:
> 
> The max heap could be the max heap used by the process uptill now. And not
> the max value you have set. I would suggest you increase the load by at
> least 20 times to see the max heap to go to 32 gb.
> 
> 
> Deepak
> "The greatness of a nation can be judged by the way its animals are treated
> - Mahatma Gandhi"
> 
> +91 73500 12833
> deicool@gmail.com
> 
> Facebook: https://www.facebook.com/deicool
> LinkedIn: www.linkedin.com/in/deicool
> 
> "Plant a Tree, Go Green"
> 
> Make In India : http://www.makeinindia.com/home
> 
> 
>> On Thu, Mar 9, 2023 at 8:21 AM Shawn Heisey <ap...@elyograg.org> wrote:
>> 
>>> On 3/8/2023 9:24 AM, HariBabu kuruva wrote:
>>> I have set the Heap memory as -Xms 1g -Xmx 40g in the Production
>>> environment.
>>> 
>>> But when i see the Heap memory in the Solr UI. I can see the Max Heap
>> below.
>>> 
>>> Max: 3.8Gb
>>> Used: 2.2Gb
>> 
>> The other answers you've gotten are good.  This is mostly just a little
>> more detail.
>> 
>> If you really do have the spaces before the 1g and 40g, then those
>> values are probably not being honored as Jan said.
>> 
>> If you don't have the spaces, then Java will start with the heap size at
>> 1GB, and only increase it if there is enough memory pressure.  One thing
>> that I don't know is whether Java will use the 32 bit pointers with the
>> Xmx at 40g.  It probably won't, so I expect that memory usage would be
>> more efficient if you set the max heap to 31g.
>> 
>> With a heap size at 32GB or larger, Java has to use 64 bit pointers, and
>> that will make it use quite a bit more memory because Solr creates a LOT
>> of objects.
>> 
>> As Dave said, if you use Xms and Xmx, then they should be set to the
>> same value.  And the value should be less than 32GB for efficiency.
>> 
>> If you use the SOLR_HEAP environment variable in the include script,
>> then both Xms and Xmx will be set to the provided value.
>> 
>> Thanks,
>> Shawn
>> 

Re: Solr Heap Memory Settings

Posted by Deepak Goel <de...@gmail.com>.
The max heap could be the max heap used by the process uptill now. And not
the max value you have set. I would suggest you increase the load by at
least 20 times to see the max heap to go to 32 gb.


Deepak
"The greatness of a nation can be judged by the way its animals are treated
- Mahatma Gandhi"

+91 73500 12833
deicool@gmail.com

Facebook: https://www.facebook.com/deicool
LinkedIn: www.linkedin.com/in/deicool

"Plant a Tree, Go Green"

Make In India : http://www.makeinindia.com/home


On Thu, Mar 9, 2023 at 8:21 AM Shawn Heisey <ap...@elyograg.org> wrote:

> On 3/8/2023 9:24 AM, HariBabu kuruva wrote:
> > I have set the Heap memory as -Xms 1g -Xmx 40g in the Production
> > environment.
> >
> > But when i see the Heap memory in the Solr UI. I can see the Max Heap
> below.
> >
> > Max: 3.8Gb
> > Used: 2.2Gb
>
> The other answers you've gotten are good.  This is mostly just a little
> more detail.
>
> If you really do have the spaces before the 1g and 40g, then those
> values are probably not being honored as Jan said.
>
> If you don't have the spaces, then Java will start with the heap size at
> 1GB, and only increase it if there is enough memory pressure.  One thing
> that I don't know is whether Java will use the 32 bit pointers with the
> Xmx at 40g.  It probably won't, so I expect that memory usage would be
> more efficient if you set the max heap to 31g.
>
> With a heap size at 32GB or larger, Java has to use 64 bit pointers, and
> that will make it use quite a bit more memory because Solr creates a LOT
> of objects.
>
> As Dave said, if you use Xms and Xmx, then they should be set to the
> same value.  And the value should be less than 32GB for efficiency.
>
> If you use the SOLR_HEAP environment variable in the include script,
> then both Xms and Xmx will be set to the provided value.
>
> Thanks,
> Shawn
>

Re: Solr Heap Memory Settings

Posted by Shawn Heisey <ap...@elyograg.org>.
On 3/8/2023 9:24 AM, HariBabu kuruva wrote:
> I have set the Heap memory as -Xms 1g -Xmx 40g in the Production
> environment.
> 
> But when i see the Heap memory in the Solr UI. I can see the Max Heap below.
> 
> Max: 3.8Gb
> Used: 2.2Gb

The other answers you've gotten are good.  This is mostly just a little 
more detail.

If you really do have the spaces before the 1g and 40g, then those 
values are probably not being honored as Jan said.

If you don't have the spaces, then Java will start with the heap size at 
1GB, and only increase it if there is enough memory pressure.  One thing 
that I don't know is whether Java will use the 32 bit pointers with the 
Xmx at 40g.  It probably won't, so I expect that memory usage would be 
more efficient if you set the max heap to 31g.

With a heap size at 32GB or larger, Java has to use 64 bit pointers, and 
that will make it use quite a bit more memory because Solr creates a LOT 
of objects.

As Dave said, if you use Xms and Xmx, then they should be set to the 
same value.  And the value should be less than 32GB for efficiency.

If you use the SOLR_HEAP environment variable in the include script, 
then both Xms and Xmx will be set to the provided value.

Thanks,
Shawn