First of all the what, not so much the why: http://www.elastic.co/guide/en/elasticsearch/guide/master/heap-sizing.html
In order of depth, first one provides light coverage of the topic: http://linux-mm.org/Low_On_Memory http://www.linuxhowtos.org/System/Linux%20Memory%20Management.htm http://www.tldp.org/LDP/tlk/mm/memory.html https://www.kernel.org/doc/gorman/pdf/understand.pdf This is also pretty good but deals more with memory management in ES not out. http://jprante.github.io/2012/11/28/Elasticsearch-Java-Virtual-Machine-settings-explained.html On Friday, April 3, 2015 at 10:52:57 AM UTC-6, Yogesh wrote: > > Thanks Aaron. Your post was very informative. > Can you recommend any blogposts, articles etc. where I could read more on > this topic? > > Thanks again for your help. > > On Tuesday, March 31, 2015 at 9:57:58 PM UTC+5:30, Aaron Mefford wrote: >> >> You need to read up a bit on how memory is allocated in Linux. >> >> In an ElasticSearch or Database server, this seems to be both, you want >> that free column to be 0. All available free memory should be used to >> cache files. In your snapshot you have 35GB of file cache listed under the >> cached heading. Memory listed under cached is essentially free memory that >> is temporarily being used to cache files until it is otherwise requested. >> This is how Linux makes efficient use of your memory, leveraging free >> memory for file cache, but still having it available when you need it. As >> such when determining if your box is out of memory you need to sum free and >> cached. >> >> This is precisely the reason that it is recommended that ElasticSearch >> only be allocated 50% of the memory on the box for heap. In your case >> where you have databases running, it should be 50% of the memory you have >> available for ElasticSearch. For that matter you should apply the same >> basic rule( 50%) to your database unless it has specifically some other >> file caching mechanism. For instance, you have 50GB of ram, assuming MySQL >> and ElasticSearch, and you want to equally divide the ram, 25GB to each. >> ElasticSearch then would be allowed to use 25GB, 12GB should be allocated >> to heap, the balance left to the OS for file caching on behalf of >> ElasticSearch. Assuming MySQL, with MyIsam, the same would be done 12GB to >> MySQL, 12GB to the OS for file system caching of the MyISAM tables. Now if >> you are using InnoDB things are different but that is way outside the scope >> of this discussion. >> >> So that you have 35GB of files being cached is a very good thing. It >> means that you have a large amount of your data cached. It means you have >> ample free memory, well beyond the 12GB a 50/50 split would demand. The >> 12GB of free you have now probably came from the processes that you killed, >> I think you meant this was ElasticSearch, though you were not specific. >> >> The one concern I see looking at your top, is that you have a large swap, >> and that some of it has been used. This is a sign that at some point you >> had memory pressure, the only sign I see from your snapshot. That pressure >> was not significant, but any swapping will destroy the performance of a >> database, or ElasticSearch. In many cases people go to the extreme of >> disabling swap entirely, as performance during swapping will be so poor, >> that it will be unusable. Further by the time you were to even put a dent >> in the size of that swap you will have wanted to reboot your box. My >> approach is to keep a small swap available, so that I can see if the system >> ever got to a point that it needed it, and to potentially buy a moment of >> time. >> >> If you are experiencing database slowdowns, this screenshot does not >> illustrate that it is due to memory issues. Rather I would suspect disk IO >> instead based on this information. >> >> On Tuesday, March 31, 2015 at 4:25:40 AM UTC-6, Yogesh wrote: >>> >>> Thanks Uwe. As I mentioned earlier, I did guess that VIRT doesn't >>> indicate RAM consumption. >>> >>> What I am concerned about is the 3rd row which shows memory and >>> indicates that out of the total 50g, 43g is in use. Once this number >>> crosses 45g, my other databases start behaving badly. >>> >>> Problem is, even after I kill all the processes, this doesn't go down. >>> (Attaching snapshot of top after killing all processes). Right now what I >>> do is reboot the system every three days which is the time it takes to >>> gradually fill the memory with something (I have no clue what that is). >>> >>> Though I think the max file descriptors wouldn't be the culprit for >>> this? I haven't changed that yet. >>> >>> On Mon, Mar 30, 2015 at 3:19 AM, Uwe Schindler <uwe.h.s...@gmail.com> >>> wrote: >>> >>>> You should read: >>>> http://blog.thetaphi.de/2012/07/use-lucenes-mmapdirectory-on-64bit.html >>>> >>>> Maybe this allows you to figure out what's going on! VIRT means nothing >>>> about consumption, you should look at RES. >>>> >>>> Thanks, >>>> Uwe >>>> >>>> >>>> Am Sonntag, 29. März 2015 22:23:00 UTC+2 schrieb Yogesh: >>>>> >>>>> Hi, >>>>> >>>>> I have a single node ES setup (50GB memory, 500GB disk, 4 cores) and I >>>>> run the Twitter river on it. I've set the ES_HEAP_SIZE to 5g. However, >>>>> when >>>>> I do "top", the ES process shows the VIRT memory to be around 34g. That >>>>> would be I assume the max mapped memory. The %MEM though always hovers >>>>> around 10% >>>>> >>>>> However, within a few days post-reboot, the memory used keeps going >>>>> up. From 10g to almost 50g (as shown in the third line) because of which >>>>> my >>>>> other dbs start behaving badly. Below is the snapshot of "top". Despite >>>>> the >>>>> fact that VIRT and %MEM still hover around the same 34g and 10% >>>>> respectively. >>>>> >>>>> Please help me understand where is my memory going over time! My one >>>>> guess is that Lucene is eating it up. How do I remedy it? >>>>> >>>>> Thanks-in-advance! >>>>> >>>>> >>>>> >>>>> <https://lh3.googleusercontent.com/-zD9y4f2Eqqk/VRhdtX2XtTI/AAAAAAAAAN8/aq8-wxm2bBg/s1600/top.png> >>>>> >>>>> >>>>> -- >>>> You received this message because you are subscribed to a topic in the >>>> Google Groups "elasticsearch" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/elasticsearch/kTDNDJwxOzA/unsubscribe >>>> . >>>> To unsubscribe from this group and all its topics, send an email to >>>> elasticsearc...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/elasticsearch/c6e834ab-77c4-4a99-9307-b6b3baf0d232%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/elasticsearch/c6e834ab-77c4-4a99-9307-b6b3baf0d232%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9f5160f2-994e-4f08-99bf-0f0af181916e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.