On 3/31/2016 7:25 AM, Bastien Latard - MDPI AG wrote:
> I read this very interesting post 'Understanding and tuning your Solr
> caches
> <https://teaspoon-consulting.com/articles/solr-cache-tuning.html>' !
> This is the only good document that I was able to find after searching
> for 1 day!
>
> /I was using Solr for 2 years without knowing in details what it was
> caching...(because I did not need to understand it before).//
> //I had to take a look since I needed to restart (regularly) my tomcat
> in order to improve performances.../
>
> But I now have 2 questions:
> 1) *How can I know how much RAM is my solr using**in real*(especially
> for caching)?
> 2) Could you have a quick look into the following images and tell me
> if I'm doing something wrong?

Getting a comprehensive breakdown of how Solr is using memory is NOT
straightforward, requiring special tools (some of which are included
with Java) and an understanding of how to use them.  It *IS* fairly easy
to find out how much TOTAL memory is in use.

Some low-level groundwork is being done that will hopefully make it easy
to include a memory usage breakdown in a future version of the admin
UI.  Don't quote me on this -- I'm guessing.  I would love to see that
functionality.

FYI -- your Solr caches aren't big enough to be huge memory consumers. 
Probably only a *maximum* of a couple hundred MB for your largest core,
but very likely less.

Your "htop" screenshot shows that Solr/Tomcat was consuming
approximately 5GB of real heap memory at the  moment you took the
screenshot -- the RES size minus the SHR size.  Looking at the VIRT
size, I can see that your total index size (all cores) is in the
neighborhood of 130GB.

In your third screenshot, I can see that your max heap is 40GB.  It is
highly unlikely that you will need a heap this large.  I'm betting that
the reason your performance gets better after a restart is that you're
freeing up a large amount of heap memory.  Over time, Solr/Tomcat will
use the entire 40GB that you've given it as the max heap, leaving you
only about 24GB of RAM to cache about 130GB of index data, and also most
likely causing some extremely long GC pauses.

I think that if you lower the max heap, you will no longer need to
restart.  Drop the max heap to 8GB and see if Solr will still work
properly.  If it doesn't, try 12GB, and then 16GB.  This wiki article
contains a small amount of info about choosing the proper heap size:

https://wiki.apache.org/solr/SolrPerformanceProblems#How_much_heap_space_do_I_need.3F

You should also look into GC tuning.  Upgrading to Solr 5.x would give
you GC tuning out of the box.  If you want to keep running your custom
Solr 4.x version in Tomcat, my personal wiki page has tuning info:

http://wiki.apache.org/solr/ShawnHeisey

Thanks,
Shawn

Reply via email to