Elastic针对Elasticsearch的性能测试/压力测试提供了一套工具——EsRally,可以方便我们快速的对Elasticsearch按照特定数据、脚本和配置进行相关性能和压力测试,并且返回整个运行过程的详细的运行指标。同时,官方也维护了一套每夜运行的基础测试环境——Elasticsearch-Benchmark,通过提供标准硬件上的测试结果以供大家参考。相信有不少人在正式搭建集群投入生产之前都曾查看过该数据,用于辅助根据和吞吐和性能确定集群规模。
以下是Elasticsearch-Benchmark上用于测试的数据集、ES发行分支、运行环境的基本信息
Benchmarking Environment:
Current environment
All benchmarks are run on bare-metal machines with the following specifications:
虽然说以上的数据并不能直接作为生产集群搭建的依据,但是在通常情况下还是可以作为一个基线参考,以确定特定版本,特定分支,在通常情况下的一个正常吞吐和查询的性能情况。特别是在我们考虑搭建新集群或者升级的时候,作为重要的性能参考指标。比如:
要回答这些问题,我们就要参考具体的运行指标了,以 http-logs
为例,benchmark上可以参考如下指标:
大家一定很纳闷,这里的参数到底是啥意思啊?
这里为大家带来解读,首先是index-troughput
,这个指标包含了集群的性能和单机性能两个部分,所以会有更多的指标值:
- 3nodes-4g
- defaults
- 4g
- no-src-4g
- sorted-4g
- no-src-4g-grok
- security-4g
3nodes
自然代表了这是一个三个节点的,4g代表的是这个car是一个4g的堆内存
"track-params": {
"number_of_replicas": 1
},
"car": "4gheap",
"node-count": 3
}
这里,集群模式下是一副本的配置,所以你会看到3节点的吞吐是20000/s
左右,而单节点是13000/s
左右,主要是副本的原因。
如何配置car可以查看EsRally的文档:
这里,我们可以看到defaults
是一个默认启动的1GB内存的ES节点。
那么剩下的又代表什么呢?
"source_enabled": false
"source_enabled": false; "ingest_pipeline": "grok"
"x-pack": "security"
{
"name": "http_logs-no-src-1node",
"label": "no-src-4g",
"charts": [
"indexing"
],
"challenge": "append-no-conflicts-index-only",
"track-params": {
"source_enabled": false
},
"car": "4gheap"
},
{
"name": "http_logs-appendsorted-4g-1node",
"label": "sorted-4g",
"charts": [
"indexing"
],
"challenge": "append-sorted-no-conflicts",
"car": "4gheap"
},
{
"name": "http_logs-grok-no-src-1node",
"label": "no-src-4g-grok",
"charts": [
"indexing"
],
"challenge": "append-index-only-with-ingest-pipeline",
"track-params": {
"source_enabled": false,
"ingest_pipeline": "grok"
},
"car": "4gheap"
},
{
"name": "http_logs-append-4g-1node",
"label": "security-4g",
"charts": [
"indexing",
"query"
],
"challenge": "append-no-conflicts",
"car": "4gheap",
"x-pack": [
"security"
],
"exclude-tasks": "force-merge-1-seg,refresh-after-force-merge-1-seg,desc-sort-timestamp-after-force-merge-1-seg,asc-sort-timestamp-after-force-merge-1-seg"
}
我们可以看到这里有挺多的challenge
,还是以http_logs
为例,我们可以在rally的安装目录下找到tracks/default/http_logs/challenges/default.json
,它定义的是基准的测试方案,在运行一次测试的时候我们该执行哪些操作:
{
"name": "append-no-conflicts",
"description": "Indexes the whole document corpus using Elasticsearch default settings. We only adjust the number of replicas as we benchmark a single node cluster and Rally will only start the benchmark if the cluster turns green. Document ids are unique so all index operations are append only. After that a couple of queries are run.",
"default": true,
"schedule": [
{
"operation": "delete-index"
},
{
"operation": {
"operation-type": "create-index",
"settings": {{index_settings | default({}) | tojson}}
}
},
{
"name": "check-cluster-health",
"operation": {
"operation-type": "cluster-health",
"index": "logs-*",
"request-params": {
"wait_for_status": "{{cluster_health | default('green')}}",
"wait_for_no_relocating_shards": "true"
}
}
},
{
"operation": "index-append",
"warmup-time-period": 240,
"clients": {{bulk_indexing_clients | default(8)}}
},
{
"name": "refresh-after-index",
"operation": "refresh"
},
{
"operation": {
"operation-type": "force-merge",
"request-timeout": 7200
}
},
{
"name": "refresh-after-force-merge",
"operation": "refresh"
},
{
"name": "wait-until-merges-finish",
"operation": {
"operation-type": "index-stats",
"index": "_all",
"condition": {
"path": "_all.total.merges.current",
"expected-value": 0
},
"retry-until-success": true,
"include-in-reporting": false
}
},
{
"operation": "default",
"warmup-iterations": 500,
"iterations": 100,
"target-throughput": 8
},
{
"operation": "term",
"warmup-iterations": 500,
"iterations": 100,
"target-throughput": 50
},
{
"operation": "range",
"warmup-iterations": 100,
"iterations": 100,
"target-throughput": 1
},
{
"operation": "hourly_agg",
"warmup-iterations": 100,
"iterations": 100,
"target-throughput": 0.2
},
{
"operation": "scroll",
"warmup-iterations": 100,
"iterations": 200,
"#COMMENT": "Throughput is considered per request. So we issue one scroll request per second which will retrieve 25 pages",
"target-throughput": 1
},
{
"operation": "desc_sort_timestamp",
"warmup-iterations": 200,
"iterations": 100,
"target-throughput": 0.5
},
{
"operation": "asc_sort_timestamp",
"warmup-iterations": 200,
"iterations": 100,
"target-throughput": 0.5
},
{
"name": "force-merge-1-seg",
"operation": {
"operation-type": "force-merge",
"max-num-segments": 1,
"request-timeout": 7200
}
},
{
"name": "refresh-after-force-merge-1-seg",
"operation": "refresh"
},
{
"name": "wait-until-merges-1-seg-finish",
"operation": {
"operation-type": "index-stats",
"index": "_all",
"condition": {
"path": "_all.total.merges.current",
"expected-value": 0
},
"retry-until-success": true,
"include-in-reporting": false
}
},
{
"name": "desc-sort-timestamp-after-force-merge-1-seg",
"operation": "desc_sort_timestamp",
"warmup-iterations": 200,
"iterations": 100,
"target-throughput": 2
},
{
"name": "asc-sort-timestamp-after-force-merge-1-seg",
"operation": "asc_sort_timestamp",
"warmup-iterations": 200,
"iterations": 100,
"target-throughput": 2
}
]
},
{
"name": "append-no-conflicts-index-only",
"description": "Indexes the whole document corpus using Elasticsearch default settings. We only adjust the number of replicas as we benchmark a single node cluster and Rally will only start the benchmark if the cluster turns green. Document ids are unique so all index operations are append only.",
"schedule": [
{
"operation": "delete-index"
},
{
"operation": {
"operation-type": "create-index",
"settings": {{index_settings | default({}) | tojson}}
}
},
{
"name": "check-cluster-health",
"operation": {
"operation-type": "cluster-health",
"index": "logs-*",
"request-params": {
"wait_for_status": "{{cluster_health | default('green')}}",
"wait_for_no_relocating_shards": "true"
}
}
},
{
"operation": "index-append",
"warmup-time-period": 240,
"clients": {{bulk_indexing_clients | default(8)}}
},
{
"name": "refresh-after-index",
"operation": "refresh"
},
{
"operation": {
"operation-type": "force-merge",
"request-timeout": 7200
}
},
{
"name": "refresh-after-force-merge",
"operation": "refresh"
},
{
"name": "wait-until-merges-finish",
"operation": {
"operation-type": "index-stats",
"index": "_all",
"condition": {
"path": "_all.total.merges.current",
"expected-value": 0
},
"retry-until-success": true,
"include-in-reporting": false
}
}
]
},
{
"name": "append-sorted-no-conflicts",
"description": "Indexes the whole document corpus in an index sorted by timestamp field in descending order (most recent first) and using a setup that will lead to a larger indexing throughput than the default settings. Document ids are unique so all index operations are append only.",
"schedule": [
{
"operation": "delete-index"
},
{
"operation": {
"operation-type": "create-index",
"settings": {%- if index_settings is defined %} {{index_settings | tojson}} {%- else %} {
"index.sort.field": "@timestamp",
"index.sort.order": "desc"
}{%- endif %}
}
},
{
"name": "check-cluster-health",
"operation": {
"operation-type": "cluster-health",
"index": "logs-*",
"request-params": {
"wait_for_status": "{{cluster_health | default('green')}}",
"wait_for_no_relocating_shards": "true"
}
}
},
{
"operation": "index-append",
"warmup-time-period": 240,
"clients": {{bulk_indexing_clients | default(8)}}
},
{
"name": "refresh-after-index",
"operation": "refresh"
},
{
"operation": {
"operation-type": "force-merge",
"request-timeout": 7200
}
},
{
"name": "refresh-after-force-merge",
"operation": "refresh"
},
{
"name": "wait-until-merges-finish",
"operation": {
"operation-type": "index-stats",
"index": "_all",
"condition": {
"path": "_all.total.merges.current",
"expected-value": 0
},
"retry-until-success": true,
"include-in-reporting": false
}
}
]
},
{
"name": "append-index-only-with-ingest-pipeline",
"description": "Indexes the whole document corpus using Elasticsearch default settings. We only adjust the number of replicas as we benchmark a single node cluster and Rally will only start the benchmark if the cluster turns green. Document ids are unique so all index operations are append only. Runs the documents through an ingest node pipeline to parse the http logs. May require --elasticsearch-plugins='ingest-geoip' ",
"schedule": [
{
"operation": "delete-index"
},
{
"operation": {
"operation-type": "create-index",
"settings": {{index_settings | default({}) | tojson}}
}
},
{
"name": "check-cluster-health",
"operation": {
"operation-type": "cluster-health",
"index": "logs-*",
"request-params": {
"wait_for_status": "{{cluster_health | default('green')}}",
"wait_for_no_relocating_shards": "true"
}
}
},
{
"operation": "create-http-log-{{ingest_pipeline | default('baseline')}}-pipeline"
},
{
"operation": "index-append-with-ingest-{{ingest_pipeline | default('baseline')}}-pipeline",
"warmup-time-period": 240,
"clients": {{bulk_indexing_clients | default(8)}}
},
{
"name": "refresh-after-index",
"operation": "refresh"
},
{
"operation": {
"operation-type": "force-merge",
"request-timeout": 7200
}
},
{
"name": "refresh-after-force-merge",
"operation": "refresh"
},
{
"name": "wait-until-merges-finish",
"operation": {
"operation-type": "index-stats",
"index": "_all",
"condition": {
"path": "_all.total.merges.current",
"expected-value": 0
},
"retry-until-success": true,
"include-in-reporting": false
}
}
]
},
{
"name": "update",
"schedule": [
{
"operation": "delete-index"
},
{
"operation": {
"operation-type": "create-index",
"settings": {%- if index_settings is defined %} {{index_settings | tojson}} {%- else %} {
"index.number_of_shards": {{number_of_shards | default(1)}},
"index.number_of_replicas": {{number_of_replicas | default(0)}},
"index.store.type": "{{store_type | default('fs')}}"
}{%- endif %}
}
},
{
"name": "check-cluster-health",
"operation": {
"operation-type": "cluster-health",
"index": "logs-*",
"request-params": {
"wait_for_status": "{{cluster_health | default('green')}}",
"wait_for_no_relocating_shards": "true"
}
}
},
{
"operation": "update",
"warmup-time-period": 240,
"clients": {{bulk_indexing_clients | default(8)}}
},
{
"name": "refresh-after-index",
"operation": "refresh"
},
{
"operation": {
"operation-type": "force-merge",
"request-timeout": 7200
}
},
{
"name": "refresh-after-force-merge",
"operation": "refresh"
},
{
"name": "wait-until-merges-finish",
"operation": {
"operation-type": "index-stats",
"index": "_all",
"condition": {
"path": "_all.total.merges.current",
"expected-value": 0
},
"retry-until-success": true,
"include-in-reporting": false
}
}
]
},
{
"name": "append-no-conflicts-index-reindex-only",
"description": "Indexes the whole document corpus using Elasticsearch default settings. We only adjust the number of replicas as we benchmark a single node cluster and Rally will only start the benchmark if the cluster turns green. Document ids are unique so all index operations are append only. After indexing, same data are reindexed.",
"schedule": [
{
"operation": "delete-index"
},
{
"operation": {
"operation-type": "create-index",
"settings": {{index_settings | default({}) | tojson}}
}
},
{
"name": "check-cluster-health",
"operation": {
"operation-type": "cluster-health",
"index": "logs-*",
"request-params": {
"wait_for_status": "{{cluster_health | default('green')}}",
"wait_for_no_relocating_shards": "true"
}
}
},
{
"operation": "index-append",
"warmup-time-period": 240,
"clients": {{bulk_indexing_clients | default(8)}}
},
{
"name": "refresh-after-index",
"operation": "refresh"
},
{
"operation": {
"operation-type": "force-merge",
"request-timeout": 7200
}
},
{
"name": "refresh-after-force-merge",
"operation": "refresh"
},
{
"name": "wait-until-merges-finish",
"operation": {
"operation-type": "index-stats",
"index": "_all",
"condition": {
"path": "_all.total.merges.current",
"expected-value": 0
},
"retry-until-success": true,
"include-in-reporting": false
}
},
{
"name": "reindex",
"operation": {
"operation-type": "reindex",
"body": {
"source": {
"index": "logs-*"
},
"dest": {
"index": "reindexed-logs"
}
},
"request_timeout": 7200
}
}
]
}
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有