Elasticsearch配置官方建議

第一 有關內存
修改ES_MIN_MEM 和 ES_MAX_MEM 建議:
in general, the more memory allocated to the process, the better(一般,越大越好)
It is recommended to set the min and max memory to the same value, and enable mlockall.(建議設置成相同的值,而且開啓mlockall)
No more than 50% of available RAM (不要超過內存的一半)
No more than 32 GB: If the heap is less than 32 GB, the JVM can use compressed pointers, which saves a lot of memory: 4 bytes per pointer instead of 8 bytes.(不要超過32G,由於對於JVM,小於32G的時候會使用壓縮指針,這個會節省很大內存)
Increasing the heap from 32 GB to 34 GB would mean that you have much less memory available, because all pointers are taking double the space. Also, with bigger heaps, garbage collection becomes more costly and can result in node instability.(從32G到34G,意味着你失去了更多的可用內存,由於全部的內存指針都變成了double,並且heap越大,GC花銷越大,這將是不穩定因素)node

第二:關於GC
建議 Don’t Touch These Settings!(不要觸碰這些設置)
We would like to recommend G1GC someday, but for now, it is simply not stable enough to meet the demands of Elasticsearch and Lucene.(咱們很期待之後某一天推薦G1 GC,可是對於如今,它對於elasticsearch和lucene來講不能足夠穩定(你仍是老實用CMS GC吧)app

第三:關於SWAP
建議:Swapping is very bad for performance and for node stability, so it should be avoided at all costs.
(swapping 對性能和節點穩定性是至關有影響的,so必定要禁掉它。less

第四:關於查詢elasticsearch

It may surprise you to find that Elasticsearch does not load into fielddata just the values for the documents that match your query. It loads the values for all documents in your index, even documents with a different _type!
(elasticsearch並非只把知足你查詢條件的文檔加載到內存,而是加載整個index的全部數據到內存,甚至是不一樣的_type,你可能很吃驚,事實就是這樣)
To make sorting efficient, Elasticsearch loads all the values for the field that you want to sort on into memory. This is referred to as fielddata.(爲了排序,elasticsearch會把這個字段的全部的值都加載到內存裏,也就是所謂的fielddata)ide

indices.fielddata.cache.size: 40%
this setting is a safeguard, not a solution for insufficient memory.
If you don’t have enough memory to keep your fielddata resident in memory, Elasticsearch will constantly have to reload data from disk, and evict other data to make space. Evictions cause heavy disk I/O and generate a large amount of garbage in memory, which must be garbage collected later on.
(一大堆說明,意思就是fielddata的加載是很昂貴的,默認對fielddata是不限制大小的,你能夠限制,限制是爲了預警,而不是內存不足的解決方案,我理解的意思就是:若是你的數據很大,仍是建議不要用排序)性能

相關文章
相關標籤/搜索