Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the Elasticsearch optimization recommendations?

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "what are the Elasticsearch optimization recommendations?" in the operation of actual cases, many people will encounter such a dilemma, and then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Memory optimization

Configure in bin/elasticsearch.in.sh

Change the configuration item to as much memory as possible:

ES_MIN_MEM=8g

ES_MAX_MEM=8g

The two had better be changed to the same, otherwise it is easy to cause long-term GC (stop-the-world).

The default GC used by elasticsearch is CMS GC

If your memory size exceeds 6 gigabytes of memory, the CMS is not good, and it is easy to have stop-the-world.

G1 GC is recommended

Comment out:

JAVA_OPTS= "$JAVA_OPTS-XX:+UseParNewGC"

JAVA_OPTS= "$JAVA_OPTS-XX:+UseConcMarkSweepGC"

JAVA_OPTS= "$JAVA_OPTS-XX:CMSInitiatingOccupancyFraction=75"

JAVA_OPTS= "$JAVA_OPTS-XX:+UseCMSInitiatingOccupancyOnly"

Modified to:

JAVA_OPTS= "$JAVA_OPTS-XX:+UseG1GC"

JAVA_OPTS= "$JAVA_OPTS-XX:MaxGCPauseMillis=200"

If the advantage of G1 GC is to reduce the probability of stop-the-world, but the share of CPU is high.

2. Reasonable configuration of master node and data node.

Configuration file: conf/elasticsearch.yaml

Node.master: true

Node.data: true

1) when master is false and data is true, it will cause heavy load on the node.

2) when master is true and data is false, the node acts as a coordinator

3) when master is both false,data and false, the node becomes a load balancer.

3. Set a reasonable refresh time

The index established will not be found immediately. This is why elasticsearch is near-real-time.

The index.refresh_interval parameter needs to be configured. The default is 1s.

Call interface configuration

It can also be written directly to the conf/elasticsearch.yaml file.

Index.refresh_interval:1s

So that all newly created indexes use this refresh rate.

This is the end of the content of "what are the Elasticsearch optimization recommendations". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report