如何解读Elasticsearch benchmark上的各种指标

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"
            }
          }
        },
        {
          "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
          }
        }
      ]
    }
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页