Elasticsearch 6.0 性能调优

2018-06-09 10:01:33
712次阅读
0个评论
配置JVM HEAP MAP
$ sudo vim /etc/elasticsearch/jvm.options
""
-Xms4g
-Xmx4g
""
$ sudo systemctl restart elasticsearch.service


参考:https://stackoverflow.com/questions/18132719/how-to-change-elasticsearch-max-memory-size

修改系统允许的最大文件打开数
// 使用下面命令然后查看open file的数字
$ ulimit -a
// 将最大文件打开数调整为20480
$ sudo vim /etc/security/limits.conf
""
*   soft nofile   20480
*   hard nofile   20480
""
$ sudo reboot -h now


最大内存不要超过32G
跨 32G 时,有一个现象,使用更多的内存,比如 40G,效果还不如31G! 
https://www.elastic.co/guide/en/elasticsearch/guide/master/heap-sizing.html#compressed_oops

heap内存锁定
$ sudo vim /etc/elasticsearch/elasticsearch.yml
""
// 让 JVM 启动的时候就 锁定 heap 内存,防止被OS SWAP掉
bootstrap.mlockall: true
""
$ sudo systemctl restart elasticsearch.service

禁止内存交互
从内存交换到硬盘,会损失执行的速度,所以我们为了速度的提升,可以禁止数据SWAP到硬盘

$ sudo vim /etc/fstab


然后注释掉带swap字符串的那一行

清除缓存
$ curl -XPOST "localhost:9200/_cache/clear" -u elastic


收藏00

登录 后评论。没有帐号? 注册 一个。