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
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
步骤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
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
步骤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.org.s3.amazonaws.com/corpora/geonames/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.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.3.4/elasticsearch-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
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
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 [s] | 89.121 |
| Total Old Gen GC [s] | 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 |
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
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
- 1
5、问题大讨论
https://discuss.elastic.co/t/the-below-bugs-appers-when-running-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。
参考:https://github.com/elastic/rally
小结
前面的确费劲周折,花费了接近3整天实践,期间甚至告诉原作者工具太难用,给作者反复沟通,最终问题解决。看到输出结果的那一刻,整个人很兴奋。坚持到底,相信付出的力量!不断思考、反思中前行!
2016-08-08 21:00思于家中窗前
作者:铭毅天下
转载请标明出处,原文地址:
http://blog.csdn.net/laoyang360/article/details/52155481
相关推荐
《ESRally:Elasticsearch性能竞赛工具详解》 在IT行业中,特别是在大数据和搜索领域,Elasticsearch作为一款强大的开源搜索引擎,已经被广泛应用于各种场景。为了优化和测试Elasticsearch的性能,开发者们需要有一...
- **Rally 测试方案**: 性能基准测试工具。 - **多集群互联**: 实现跨集群搜索和数据共享。 - **别名的应用**: 简化索引管理。 - **映射与模板的定制**: 控制文档字段的索引方式。 - **计划内停机升级的操作流程**: ...
55links友情链接网址跟踪器,放在桌面,每次直接打开就可以访问55links友情链接交易平台,方便快捷。
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
moore_01_0909
FIBR English learning
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
OIF_IEEE802.3_liaison_19OCt09
做网络安全FTP内容的实验必备
nagarajan_01_1107
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
mellitz_3cd_01_0318
PyQt6实战派 配套代码
陕西省省级非物质文化遗产经纬度数据统计表 统计内容包含以下字段: 1. 项目名称 2. 遗产类别 3. 入选批次 4. 所属地区 5. 申报地区/单位 6. 地理经度 7. 地理纬度 该统计表系统记录了陕西省省级非物质文化遗产的地理空间信息,为文化遗产的数字化保护与研究工作提供了重要的数据支撑。
ran_3ck_02a_0918
毕业设计_基于springboot+vue开发的汽车租赁管理系统【源码+sql+可运行】【50308】.zip 全部代码均可运行,亲测可用,尽我所能,为你服务; 1.代码压缩包内容 代码:springboo后端代码+vue前端页面代码; 脚本:数据库SQL脚本 效果图:运行结果请看资源详情效果图 2.环境准备: - JDK1.8+ - maven3.6+ - nodejs14+ - mysql5.6+ - redis 3.技术栈 - 后台:springboot+mybatisPlus+Shiro - 前台:vue+iview+Vuex+Axios - 开发工具: idea、navicate 4.功能列表 - 系统设置:用户管理、角色管理、资源管理、系统日志 - 业务管理:汽车管理、客户管理、租赁订单 3.运行步骤: 步骤一:修改数据库连接信息(ip、port修改) 步骤二:找到启动类xxxApplication启动 4.若不会,可私信博主!!!
# Runcorder - 跑步训练管理系统 Runcorder 是一款专为跑步爱好者、马拉松运动员及高校体育生设计的本地化跑步训练管理工具,基于 Python 开发,结合 Tkinter 图形界面与强大的数据处理能力,为用户提供从训练记录到数据分析的全方位支持。无论是初学者还是专业跑者,Runcorder 都能帮助你科学规划训练、精准追踪进度,并通过可视化图表直观呈现训练成果,让你的跑步训练更智能、更高效! - **多用户管理**:支持创建、加载和删除用户档案,每个用户的数据独立存储,确保隐私与安全。 - **科学训练记录**:全维度记录跑步数据,包括日期、里程、配速、自评和晨跑标记,支持智能输入校验,避免数据错误。 - **多维数据分析**:通过动态可视化图表展示跑步里程趋势、平均配速曲线,支持自定义 Y 轴范围,帮助用户深入理解训练效果。 - **高阶功能**:提供 4 种科学训练模式(有氧/无氧/混合),支持历史记录修改与删除,数据以 JSON 格式持久化存储,跨平台兼容。
paatzsch_01_0708
AnythingLLM是一个全栈应用程序,您可以使用流行的开源大语言模型,再结合向量数据库解决方案构建个人本地AI大模型知识库