Elasticsearch 压测工具和基准数据
Elastic针对Elasticsearch的性能测试/压力测试提供了一套工具——EsRally,可以方便我们快速的对Elasticsearch按照特定数据、脚本和配置进行相关性能和压力测试,并且返回整个运行过程的详细的运行指标。同时,官方也维护了一套每夜运行的基础测试环境——Elasticsearch-Benchmark,通过提供标准硬件上的测试结果以供大家参考。相信有不少人在正式搭建集群投入生产之前都曾查看过该数据,用于辅助根据和吞吐和性能确定集群规模。
Elasticsearch-Benchmark
以下是Elasticsearch-Benchmark上用于测试的数据集、ES发行分支、运行环境的基本信息
测试的数据集
ES发行分支
ES发行版本
运行环境
Benchmarking Environment:
Current environment
All benchmarks are run on bare-metal machines with the following specifications:
- CPU: Intel® Core™ i7-7700 CPU @ 3.60GHz
- RAM: 32 GB
- SSD: Micron_1100_MTFDDAK512TBN
- OS for Rally load driver servers:
- Linux kernel version 4.15.0-76
- OS for Elasticsearch target servers:
- Linux kernel version 4.13.0-45
- /sys/kernel/mm/transparent_hugepage/enabled = always
- /sys/kernel/mm/transparent_hugepage/defrag = always
- /sys/devices/system/cpu/intel_pstate/no_turbo = 1
- JVM: JDK bundled with Elasticsearch.
参考意义
虽然说以上的数据并不能直接作为生产集群搭建的依据,但是在通常情况下还是可以作为一个基线参考,以确定特定版本,特定分支,在通常情况下的一个正常吞吐和查询的性能情况。特别是在我们考虑搭建新集群或者升级的时候,作为重要的性能参考指标。比如:
- 我们是否担忧安全功能全开会影响集群的性能?
- 我做集群升级是否能够在集群性能上获得更多的提升?
- docker环境和虚机环境相比性能如何?
要回答这些问题,我们就要参考具体的运行指标了,以 http-logs
为例,benchmark上可以参考如下指标:
- index-troughput 集群写吞吐
- 3nodes-4g
- defaults
- 4g
- no-src-4g
- sorted-4g
- no-src-4g-grok
- security-4g
- 4g-io,磁盘io [SSD Micron_1100_MTFDDAK512TBN]
- 4g-gc
- 4g-segment-memory
- 4g-default-latency
- 4g-range-latency
- 4g-hourly_agg-latency
- 4g-scroll-latency
- 4g-desc_sort_timestamp-latency
- 4g-asc_sort_timestamp-latency
指标解读
大家一定很纳闷,这里的参数到底是啥意思啊?
这里为大家带来解读,首先是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节点。
那么剩下的又代表什么呢?
- no-src-4g ——
"source_enabled": false
- sorted-4g —— 默认排序,只append数据
- no-src-4g-grok ——
"source_enabled": false; "ingest_pipeline": "grok"
- security-4g ——
"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"
}
}
},