Elasticsearch性能测试工具rally深入详解题记
elasticsearch性能测试研究了很久,自己想过通过批量导入数据,然后记录时间,统计CPU、内存等变化,计算得出某个性能指标。但显然,数据量起伏不定,非常不准确。 
研究发现,github上提供了rally作为elasticsearch的性能测试工具,较好的解决了es性能测试问题。

1、esrally功能:es的性能测试工具。
esrally不支持windows版本,目前只支持Linux和Mac OS。 
esrally的运行基于以下两点假设: 
1)所有运行在同一台机器完成。(未来改假设条件可能会去掉) 
2)你需要向Elasticsearch索引中添加特定的数据集,然后在其上进行基准查询(benchmarking queries).

2、esrally安装:
前提:验证是否安装了以下内容(注意版本) 
Python 3.4+ available as python3 on the path (verify with: python3 –version which should print Python 3.4.0 or higher) 
pip3 available on the path (verify with pip3 –version) 
JDK 8 
git

如下所示:

[root@laoyang git-2.4.0]# python
Python 3.5.1 (default, Aug 2 2016, 09:53:20)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux
Type "help", "copyright", "credits" or "license" for more information.

[root@laoyang git-2.4.0]# git --version
git version 2.4.0

[root@laoyang git-2.4.0]# java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

[root@laoyang git-2.4.0]# find / -name "pip3"
/usr/bin/pip3
/usr/local/python3/bin/pip3

步骤1:安装 Rally
pip3 install esrally

步骤2:配置 Rally
调用: esrally configure 会提示让你输入 java8.home(也就是JAVA_HOME设定的环境变量路径)。 
仅java8.home使用自己本机的JAVA_HOME环境变量路径,其他采用默认值即可。

[root@laoyang .rally]# cat /root/.rally/rally.ini
[meta]
config.version = 5

[system]
root.dir = /root/.rally/benchmarks
log.root.dir = logs
env.name = local

[source]
local.src.dir=/root/.rally/src   #注意,此路径并非elaticsearch安装路径。
remote.repo.url=https://github.com/elastic/elasticsearch.git

[provisioning]
local.install.dir = install

[runtime]
java8.home = /opt/jdk1.8.0_91  #注意,JAVA_HOME 路径为:/opt/jdk1.8.0_91

[benchmarks]
local.dataset.cache = ${system:root.dir}/data

[reporting]
datastore.type = elaticsearch
datastore.host = 10.0.1.30
datastore.port = 9200
datastore.secure = False
datastore.user =
datastore.password =

[tracks]
default.url = https://github.com/elastic/rally-tracks

步骤3:运行esrally
由于elasticsearch的运行必须非root账户。esrally建议用非root账户执行。

3、esrally执行常见问题及解决方案
问题1:版本用哪个版本?
目前用最新版本 Rally 0.3.2(2016-8-7发行)。

问题2:注意gradle需要2.13版本,高版本会不兼容。
[root@laoyang caches]# ll /usr/bin/gradle 
lrwxrwxrwx 1 root root 27 Aug 5 17:13 /usr/bin/gradle -> /opt/gradle-2.13/bin/gradle

问题3:安装时候提示 documents.json.bz2 无法下载成功。
1)手动下载: http://benchmarks.elasticsearch. ... /documents.json.bz2
2)移动到 /root/.rally/benchmarks/data/geonames/(对于root用户)
对于非root用户,elaticsearch用户,移动路径为:/home/elasticsearch/benchmarks/data/geonames/

问题4: esrally单独运行和加参数运行区别?
esrally单独运行:非常方便的指令,等价于 :esrally –pipeline=from-sources –version=current. Rally 将要通过Gradle从源码编译elasticsearch。 
esrally –pipline=from-distribution –distribution-version=2.3.4, Rally将要从 https://download.elasticsearch.o ... search-2.3.4.tar.gz

下载elaticsearch2.3.4版本运行。

问题5: Could not resolve all dependencies for configuration ‘:benchmarks:classpath’.
37 > Could not download shadow.jar (com.github.jengelman.gradle.plugins:shadow:1.2.3)如何解决? 
root账户下:

cd /home/elasticsearch/.rally/benchmarks/src 
gradle :distribution:tar:assemble

正确提示信息为:

deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:modules:transport-netty4:processResources UP-TO-DATE
:modules:transport-netty4:classes
:modules:transport-netty4:jar
:modules:transport-netty4:copyPluginPropertiesTemplate
:modules:transport-netty4:pluginProperties
:modules:transport-netty4:bundlePlugin
:distribution:buildModules
:distribution:tar:buildTar
:distribution:tar:generatePomFileForNebulaPublication
:distribution:tar:signArchives SKIPPED
:distribution:tar:assemble

BUILD SUCCESSFUL

4、esrally最终运行结果:
Preparing for race (might take a few moments) ...
  Building from sources ...
/home/elasticsearch/.rally/benchmarks/races/2016-08-08-07-29-59/local/logs/rally_out.logRacing on track [geonames] and challenge [append-no-conflicts] with car [defaults]
  Benchmarking indexing at 12183.1 docs/s [100% done]
  Benchmarking stats (warmup iteration 100/100) [100% done]
  Benchmarking stats (iteration 100/100) [100% done]
  Benchmarking search (warmup iteration 100/100) [100% done]
  Benchmarking search (iteration 100/100) [100% done]
------------------------------------------------------
  _______ __ _____
  / ____(_)___ ____ _/ / / ___/_________ ________
  / /_ / / __ \/ __ `/ / \__ \/ ___/ __ \/ ___/ _ \
/ __/ / / / / / /_/ / / ___/ / /__/ /_/ / / / __/
/_/ /_/_/ /_/\__,_/_/ /____/\___/\____/_/ \___/
------------------------------------------------------
| Metric | Value |
|----------------------------------------------------------:|----------:|
| Min Indexing Throughput [docs/s] | 11949 |
| Median Indexing Throughput [docs/s] | 12307 |
| Max Indexing Throughput [docs/s] | 13349 |
| Indexing time [min] | 164.045 |
| Merge time [min] | 32.3815 |
| Refresh time [min] | 8.82333 |
| Flush time [min] | 1.63852 |
| Merge throttle time [min] | 1.45482 |
| Query latency default (90.0 percentile) [ms] | 68.8676 |
| Query latency default (99.0 percentile) [ms] | 77.6009 |
| Query latency default (100 percentile) [ms] | 78.8328 |
| Query latency term (90.0 percentile) [ms] | 4.63227 |
| Query latency term (99.0 percentile) [ms] | 10.9506 |
| Query latency term (100 percentile) [ms] | 13.0573 |
| Query latency phrase (90.0 percentile) [ms] | 6.35018 |
| Query latency phrase (99.0 percentile) [ms] | 13.1745 |
| Query latency phrase (100 percentile) [ms] | 14.2399 |
| Query latency country_agg_uncached (90.0 percentile) [ms] | 361.913 |
| Query latency country_agg_uncached (99.0 percentile) [ms] | 384.75 |
| Query latency country_agg_uncached (100 percentile) [ms] | 392.645 |
| Query latency country_agg_cached (90.0 percentile) [ms] | 7.71451 |
| Query latency country_agg_cached (99.0 percentile) [ms] | 17.4704 |
| Query latency country_agg_cached (100 percentile) [ms] | 18.4851 |
| Query latency scroll (90.0 percentile) [ms] | 50.4234 |
| Query latency scroll (99.0 percentile) [ms] | 50.9866 |
| Query latency scroll (100 percentile) [ms] | 51.2115 |
| Query latency expression (90.0 percentile) [ms] | 482.02 |
| Query latency expression (99.0 percentile) [ms] | 485.951 |
| Query latency expression (100 percentile) [ms] | 491.999 |
| Query latency painless_static (90.0 percentile) [ms] | 890.382 |
| Query latency painless_static (99.0 percentile) [ms] | 918.354 |
| Query latency painless_static (100 percentile) [ms] | 927.282 |
| Query latency painless_dynamic (90.0 percentile) [ms] | 968.908 |
| Query latency painless_dynamic (99.0 percentile) [ms] | 1019.14 |
| Query latency painless_dynamic (100 percentile) [ms] | 1021.97 |
| Median CPU usage (index) [%] | 887.7 |
| Median CPU usage (stats) [%] | 94.9 |
| Median CPU usage (search) [%] | 445.05 |
| Total Young Gen GC | 89.121 |
| Total Old Gen GC | 12.274 |
| Index size [GB] | 3.30111 |
| Totally written [GB] | 20.2123 |
| Heap used for segments [MB] | 21.6794 |
| Heap used for doc values [MB] | 0.113129 |
| Heap used for terms [MB] | 20.0574 |
| Heap used for norms [MB] | 0.0761719 |
| Heap used for points [MB] | 0.770404 |
| Heap used for stored fields [MB] | 0.6623 |
| Segment count | 96 |
| Indices Stats(90.0 percentile) [ms] | 11.5116 |
| Indices Stats(99.0 percentile) [ms] | 14.1724 |
| Indices Stats(100 percentile) [ms] | 36.8348 |
| Nodes Stats(90.0 percentile) [ms] | 11.342 |
| Nodes Stats(99.0 percentile) [ms] | 13.435 |
| Nodes Stats(100 percentile) [ms] | 16.4768 |

Logs for this race are archived in /home/elasticsearch/.rally/benchmarks/races/2016-08-08-07-29-59/local/logs-geonames-append-no-conflicts-defaults.zip
1
5、问题大讨论
https://discuss.elastic.co/t/the ... ng-esrally/57063/25

源码 作者danielmitterdorfer一一回复, 最终作者回复: 
I am very happy too and I am glad you had so much persistence. You also uncovered a few usability problems that I need to tackle. 
帮作者提了一些建议,促使他升级了一个版本0.3.2。

elasticsearch性能测试工具rally深入详解相关推荐

  1. Jmeter性能测试工具Timer定时器详解

    jmeter提供了很多元件,帮助我们更好的完成各种场景的性能测试,其中,定时器(timer)是很重要的一个元件,jemter提供了9种定时器,下面一一介绍: 一.定时器的作用域 1.定时器是在每个sa ...

  2. apache性能测试工具ab使用详解

    网站性能压力测试是服务器网站性能调优过程中必不可缺少的一环.只有让服务器处在高压情况下,才能真正体现出软件.硬件等各种设置不当所暴露出的问题. 性能测试工具目前最常见的有以下几种:ab.http_lo ...

  3. uml建模工具 支持php,【UML 建模】在线UML建模工具 ProcessOn 使用详解

    总结: -- 推荐理由 : 最近从 Windows 操作系统 转到 MAC 上, 正在看设计模式 和 重构, 找不到好用的 UML 工具, 因此在网上找了一款可以在线使用的 UML 工具, 用起来发现 ...

  4. OpenStack 性能测试工具Rally使用

    OpenStack 性能测试工具Rally使用 Rally是OpenStack社区推出开源测试工具,可用于对OpenStack各个组件进行性能测试. 可以自动化并统一 多节点OpenStack部署,验 ...

  5. php把proto解析为文档,Protobuf 文件生成工具 Prototool 命令详解

    Protobuf 文件生成工具 Prototool 命令详解 简介 Prototool 是 Protobuf 文件的生成工具, 目前支持go, php, java, c#, object c 五种语言 ...

  6. 2021-02-07 接口测试工具-Postman使用详解

    接口测试工具-Postman使用详解 1.安装postman 官网下载地址:https://www.postman.com/downloads/ 选择好对应的版本下载,下载完后直接安装即可. 2.po ...

  7. 可视化数据库管理工具DataGrip使用详解

    参考链接:https://www.hangge.com/blog/cache/detail_2829.html 日常开发中少不了各种可视化数据库管理工具.如果需要同时能连接多种数据库,大家肯定都会想到 ...

  8. redis cluster管理工具redis-trib.rb详解

    redis cluster管理工具redis-trib.rb详解 redis-trib.rb是redis官方推出的管理redis集群的工具,集成在redis的源码src目录下,是基于redis提供的集 ...

  9. sqlmap工具使用用法详解

    2019独角兽企业重金招聘Python工程师标准>>> sqlmap工具使用用法详解 QLmap是一款用来检测与利用SQL注入漏洞的免费开源工具,有一个非常棒的特性,即对检测与利用的 ...

最新文章

  1. C#中三种定时器对象的比较
  2. CLR_via_C#.3rd 翻译[1.5 本地代码生成工具NGen.exe]
  3. python祝福祖国代码_国际文交所:9月17日-10月15日《祝福祖国信卡》《澳门爱与祝愿套票》《北京精神封》3个提货转仓公告...
  4. arcgis 字段计算器 条件赋值_【教程】ArcGIS入门教程(11)——多条件购房分析...
  5. 互联网1分钟 |1107
  6. OpenCV精进之路(十七):工具——图像配准工具
  7. 谷歌大脑阿尔伯塔联合发表:离线强化学习的优化视角【附代码】
  8. Windows和Linux DNS Cache清理
  9. 美国转基因食品的生产现状
  10. 怎么关闭计算机139端口,win10系统关闭139端口的处理教程
  11. 木马手工查杀和隐藏控制技术分析
  12. React-fiber架构的解释
  13. 星宸科技SSD202D芯片+无线投屏协议在摩托车智能仪表,电动车智能仪表批量出货。
  14. 转:Flutter做出剑气效果
  15. GESD 离群值检验——理论与 Python 实现
  16. 基于人脸识别的“带口罩”系统-python完整实现
  17. 第九届广东省大学生程序设计竞赛排名
  18. mysql 全局不重复_如何批量生成MySQL不重复手机号大表实例代码
  19. JavaWeb开发分享:WRO
  20. 从零开始整合spingMVC

热门文章

  1. 简述人工神经网络的定义,简述神经网络算法
  2. 【原创】【I2C】I2C介绍
  3. 【毕设】基于HTML的零食商城网站大前端开发设计(含文档)
  4. Link-添加网页图标
  5. 八大排序算法的稳定性及时间复杂度
  6. mysql_如果字段null,则替换
  7. 申请支付宝当面付应用
  8. 模拟退火算法学习笔记
  9. Matlab 实现 数值计算方法 二分法
  10. python动态柱状图_动态排名柱状图的两种做法