Three important optimizations of elasticsearch

1. Memory optimization
Configure in bin/elasticsearch.in.sh
Modify the configuration item to make the memory as large as possible:
ES_MIN_MEM=8g
ES_MAX_MEM=8g
It is best to change the two to the same, otherwise it will easily lead to long-term GC (stop-the- world)

The default GC used by elasticsearch is CMS GC
. If your memory size exceeds 6G, CMS is not powerful, and it is prone to stop-the-world. It is
recommended to use G1 GC to
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”
修改为:
JAVA_OPTS=”$JAVA_OPTS -XX:+UseG1GC”
JAVA_OPTS=”$JAVA_OPTS -XX:MaxGCPauseMillis=200″

If the advantage of G1 GC is to reduce the chance of stop-the-world, but the CPU usage is high.
If you need more optimized performance, you can refer to

http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/G1GettingStarted/index.html

2. Reasonably configure the master node and data node
Configuration file: conf/
elasticsearch.yaml node.master: true
node.data: true

1) When the master is false and the data is true, it will have a heavy load on the node;
2) When the master is true and the data is false, the node acts as a coordinator;
3) When the master is false, the data is also When false, the node becomes a load balancer.

3. Set a reasonable refresh time
. The established index will not be checked immediately. This is why elasticsearch is near-real-time. The index.refresh_interval parameter
needs to be configured, and the default is 1s.
you can do something like

http://zhaoyanblog.com/archives/299.html

As in the file, the calling interface configuration
can also be directly written to
index.refresh_interval: 1s in the conf/elasticsearch.yaml file,
so that all newly created indexes use this refresh frequency.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326209354&siteId=291194637