Fix Elastic search use high memory consumption on macOS

Fix Elastic search use high memory consumption on macOS

First we need to know how much elastic search usage from memory

open Activity Monitor

You notice Java is using 1GB of the memory. this is after fix before was using 8GB.
so let’s start how to make it Maximum memory usage to 1GB:
on terminal we will use this command:

ps axv | grep java

You will notice that the output for this process is for org.elasticsearch.bootstrap.Elasticsearch

Now we will use this command:

 curl "localhost:9200/_nodes/settings?pretty=true"

It will return the path of your Elastic search setup folder

        "path" : {
          "data" : "/usr/local/var/lib/elasticsearch",
          "logs" : "/usr/local/var/log/elasticsearch",
          "home" : "/usr/local/Cellar/elasticsearch-full/7.17.4/libexec"
        },

In my case I will edit the file in this path

<home Path>/config/jvm.options
/usr/local/Cellar/elasticsearch-full/7.17.4/libexec/config/jvm.options

Now we will add this lines on jvm.options

-Xms1g
-Xmx1g

This will use only 1GB

Now will stop and start elastic search so the update will be applied

brew services stop  elasticsearch-full
brew services start elasticsearch-full

Hope this helps.

Share this post


0
    0
    السلة
    السلة فارغةالعودة للمتجر