ES压测工具(一):esrally工具入门与实践

一、esrally工具介绍

esrally是基于python的针对ES(Elasticsearch)实现压测的工具

rally的定义是the macrobenchmarking framework for Elasticsearch,是基于用户视角的系统测试,不仅可以使用命令行,同时也可以将其集成到Python脚本代码当中。

  • Macro-benchmarking是基于用户视角进行系统测试,无法测试其中的代码,只能测试其功能,可以理解为黑盒测试
  • Micro-benchmarking是基于代码/模块视角代码/集成测试,是测试其中的模块或者代码

 二、rally术语介绍

1、Rally

rally是汽车拉力赛,作者是用汽车拉力赛来模拟ES压测的过程,所以把汽车拉力赛的很多名词放到了esrally当中。

2、Track

 track是赛道,在esrally当中是指被用于进行压测的数据集以及压测的方案。

3、Team/Car

team/car是赛队/赛车,在esrally当中是类比了ES的instance,不同配置的ES就是不同的赛车,不同的赛车在不同的赛道跑就是不同配置的ES跑不同的数据集和压测方案。

4、Race

race就是比赛,在esrally当中就是指跑一次压测。

5、Tournament

tournament就是锦标赛,在esrally是指规划的一次压力测试。

三、压测流程

1、定义压测目标(Tournament)

下面例举几个压测目标 

  • 测试es集群的读写性能,以进行容量规划
  • 测试es新版本的性能,做一个新旧版本的测试,以决定是否升级
  • 测试es配置修改对于性能的影响,以决定如何修改集群配置

2、准备压测数据与方案(Track)

2.1、所在目录

~/.rally/benchmarks/tracks/default

在default当中会有一些esrally自带的track

github地址:https://github.com/elastic/rally-tracks 

2.2、track的组成(以default下的logging为例)

---mappings.json与track.json是与数据集有关的

  • mappings.json定义数据模型,每个字段什么类型,要不要分词
  • track.json定义压测数据集。
mappings.json(现在叫index.json)
{
  "settings": {
    "index.number_of_shards": {{number_of_shards | default(5)}},
    "index.number_of_replicas": {{number_of_replicas | default(0)}},
    "index.requests.cache.enable": false
  },
  "mappings": {
    "type": {
      "dynamic": "strict",
      "_all": {
        "enabled": false
      },
      "_source": {
        "enabled": {{ source_enabled | default(true) | tojson }}
      },
      "properties": {
{# workaround for https://github.com/elastic/elasticsearch/issues/21745 #}
{%- if ingest_pipeline is defined and ingest_pipeline == "grok" %}
        "timestamp": {
{%- else %}
        "@timestamp": {
{%- endif %}
          "format": "strict_date_optional_time||epoch_second",
          "type": "date"
        },
        "clientip": {
          "type": "ip"
        },
        "message": {
          "type": "keyword",
          "index": false,
          "doc_values": false
        },
        "request": {
          "type": "text",
          "fields": {
            "raw": {
              "ignore_above": 256,
              "type": "keyword"
            }
          }
        },
        "status": {
          "type": "integer"
        },
        "size": {
          "type": "integer"
        },
        "geoip" : {
          "properties" : {
             "country_name": { "type": "keyword" },
             "city_name": { "type": "keyword" },
             "location" : { "type" : "geo_point" }
          }
        }
      }
    }
  }
track.json
{% import "rally.helpers" as rally with context %}

{
  "version": 2,
  "description": "HTTP server log data",
  "#TODO": "Replace index definitions with a template after setting the track version to 2. Explicit index definitions are not necessary anymore.",
  "indices": [
    {
      "name": "logs-181998",
      "body": "index.json",
      "types": ["type"]
    },
    {
      "name": "logs-191998",
      "body": "index.json",
      "types": ["type"]
    },
    {
      "name": "logs-201998",
      "body": "index.json",
      "types": ["type"]
    },
    {
      "name": "logs-211998",
      "body": "index.json",
      "types": ["type"]
    },
    {
      "name": "logs-221998",
      "body": "index.json",
      "types": ["type"]
    },
    {
      "name": "logs-231998",
      "body": "index.json",
      "types": ["type"]
    },
    {
      "name": "logs-241998",
      "body": "index.json",
      "types": ["type"]
    }
  ],
  "corpora": [
      {%- if ingest_pipeline is defined and ingest_pipeline == "grok" %}
        {
          "name": "http_logs_unparsed",
          "base-url": "http://benchmarks.elasticsearch.org.s3.amazonaws.com/corpora/http_logs",
          "target-type": "type",
          "documents": [
          {
            "target-index": "logs-181998",
            "source-file": "documents-181998.unparsed.json.bz2",
            "document-count": 2708746,
            "compressed-bytes": 13064317,
            "uncompressed-bytes": 303920342
          },
          {
            "target-index": "logs-191998",
            "source-file": "documents-191998.unparsed.json.bz2",
            "document-count": 9697882,
            "compressed-bytes": 47211781,
            "uncompressed-bytes": 1088378738
          },
          {
            "target-index": "logs-201998",
            "source-file": "documents-201998.unparsed.json.bz2",
            "document-count": 13053463,
            "compressed-bytes": 63174979,
            "uncompressed-bytes": 1456836090
          },
          {
            "target-index": "logs-211998",
            "source-file": "documents-211998.unparsed.json.bz2",
            "document-count": 17647279,
            "compressed-bytes": 85607179,
            "uncompressed-bytes": 1975990671
          },
          {
            "target-index": "logs-221998",
            "source-file": "documents-221998.unparsed.json.bz2",
            "document-count": 10716760,
            "compressed-bytes": 53190976,
            "uncompressed-bytes": 1202551382
          },
          {
            "target-index": "logs-231998",
            "source-file": "documents-231998.unparsed.json.bz2",
            "document-count": 11961342,
            "compressed-bytes": 60705435,
            "uncompressed-bytes": 1334381144
          },
          {
            "target-index": "logs-241998",
            "source-file": "documents-241998.unparsed.json.bz2",
            "document-count": 181463624,
            "compressed-bytes": 897719968,
            "uncompressed-bytes": 20563705716
          }
        ]
      }
    {%- else %}
      {
        "name": "http_logs",
        "base-url": "http://benchmarks.elasticsearch.org.s3.amazonaws.com/corpora/http_logs",
        "target-type": "type",
        "documents": [
          {
            "target-index": "logs-181998",
            "source-file": "documents-181998.json.bz2",
            "document-count": 2708746,
            "compressed-bytes": 13815456,
            "uncompressed-bytes": 363512754
          },
          {
            "target-index": "logs-191998",
            "source-file": "documents-191998.json.bz2",
            "document-count": 9697882,
            "compressed-bytes": 49439633,
            "uncompressed-bytes": 1301732149
          },
          {
            "target-index": "logs-201998",
            "source-file": "documents-201998.json.bz2",
            "document-count": 13053463,
            "compressed-bytes": 65623436,
            "uncompressed-bytes": 1744012279
          },
          {
            "target-index": "logs-211998",
            "source-file": "documents-211998.json.bz2",
            "document-count": 17647279,
            "compressed-bytes": 88258230,
            "uncompressed-bytes": 2364230815
          },
          {
            "target-index": "logs-221998",
            "source-file": "documents-221998.json.bz2",
            "document-count": 10716760,
            "compressed-bytes": 54160603,
            "uncompressed-bytes": 1438320123
          },
          {
            "target-index": "logs-231998",
            "source-file": "documents-231998.json.bz2",
            "document-count": 11961342,
            "compressed-bytes": 60927822,
            "uncompressed-bytes": 1597530673
          },
          {
            "target-index": "logs-241998",
            "source-file": "documents-241998.json.bz2",
            "document-count": 181463624,
            "compressed-bytes": 905378242,
            "uncompressed-bytes": 24555905444
          }
        ]
      }
    {%- endif %}
  ],
  "operations": [
    {{ rally.collect(parts="operations/*.json") }}
  ],
  "challenges": [
    {{ rally.collect(parts="challenges/*.json") }}
  ]
}

track.json当中data-url就是数据集的下载地址,通过下载,然后拼接到下面的定义的target-index数据集当中。

注意:所有下载的数据集文件都在 ~/.rally/benchmarks/data当中

---challenges、operations、track.json是与压测方案有关的

  • track.json定义了压测方案,相关配置(在上面的track.json可以看到operations以及challenges配置,读取配置文件)
  • operations定义了压测操作细则
  • challenges定义详细的压测方案
operations/default.json
{
      "name": "index-append",
      "operation-type": "bulk",
      "bulk-size": {{bulk_size | default(5000)}},
      "ingest-percentage": {{ingest_percentage | default(100)}},
      "corpora": "http_logs"
    },
    {
      "name": "index-append-with-ingest-baseline-pipeline",
      "operation-type": "bulk",
      "bulk-size": {{bulk_size | default(5000)}},
      "ingest-percentage": {{ingest_percentage | default(100)}},
      "pipeline": "http-log-baseline-pipeline",
      "corpora": "http_logs"
    },
    {
      "name": "index-append-with-ingest-grok-pipeline",
      "operation-type": "bulk",
      "bulk-size": {{bulk_size | default(5000)}},
      "ingest-percentage": {{ingest_percentage | default(100)}},
      "pipeline": "http-log-grok-pipeline",
      "corpora": "http_logs_unparsed"
    },
    {
      "name": "index-append-with-ingest-geoip-pipeline",
      "operation-type": "bulk",
      "bulk-size": {{bulk_size | default(5000)}},
      "ingest-percentage": {{ingest_percentage | default(100)}},
      "pipeline": "http-log-geoip-pipeline",
      "corpora": "http_logs"
    },
    {
      "name": "default",
      "operation-type": "search",
      "index": "logs-*",
      "type": "type",
      "body": {
        "query": {
          "match_all": {}
        }
      }
    },
    {
      "name": "term",
      "operation-type": "search",
      "index": "logs-*",
      "type": "type",
      "body": {
        "query": {
          "term": {
            "request.raw": {
              "value": "GET / HTTP/1.0"
            }
          }
        }
      }
    },
    {
      "name": "range",
      "operation-type": "search",
      "index": "logs-*",
      "type": "type",
      "body": {
        "query": {
          "range": {
            "@timestamp": {
              "gte": "now-{{'15-05-1998' | days_ago(now)}}d/d",
              "lt": "now/d"
            }
          }
        }
      }
    },
    {
      "name": "hourly_agg",
      "operation-type": "search",
      "index": "logs-*",
      "type": "type",
      "body": {
        "size": 0,
        "aggs": {
          "by_hour": {
            "date_histogram": {
              "field": "@timestamp",
              "interval": "hour"
            }
          }
        }
      }
    },
    {
      "name": "scroll",
      "operation-type": "search",
      "index": "logs-*",
      "type": "type",
      "pages": 25,
      "results-per-page": 1000,
      "body": {
        "query": {
          "match_all": {}
        }
      }
    },
    {
      "name": "create-http-log-baseline-pipeline",
      "operation-type": "put-pipeline",
      "id": "http-log-baseline-pipeline",
      "body": {
        "description": "Process an the documents with a processor that does nothing. Baseline for overhead of pipeline.",
        "processors": [
          {
            "uppercase": {
              "field": "doesnotexist",
              "ignore_missing": true
            }
          }
        ]
      }
    },
    {
      "name": "create-http-log-grok-pipeline",
      "operation-type": "put-pipeline",
      "id": "http-log-grok-pipeline",
      "body": {
        "description": "Process an http log line with grok. Requires the `unparsed` data set.",
        "processors": [
          {
            "grok": {
              "field": "message",
              "patterns": [
                "%{IPORHOST:clientip} %{HTTPDUSER} %{USER} \\[%{TIMESTAMP_ISO8601:timestamp}\\] \"(?:%{WORD} %{NOTSPACE:request}(?: HTTP/%{NUMBER})?|%{DATA})\" %{NUMBER:status} (?:%{NUMBER:size}|-)"
              ]
            }
          }
        ]
      }
    },
    {
      "name": "create-http-log-geoip-pipeline",
      "operation-type": "put-pipeline",
      "id": "http-log-geoip-pipeline",
      "body": {
        "description": "Enrich the data with the geo-ip filter. Requires --elasticsearch-plugins='ingest-geoip'",
        "processors": [
          {
            "geoip": {
               "field": "clientip",
               "properties": [
                  "city_name",
                  "country_name",
                  "location"
                ]
            }
          }
        ]
      }
    }

operations定义了基础操作,包含以下内容:

  • 索引数据
  • term查询
  • range查询
  • 聚合查询
  • ......
chanllenges/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",
          "clients": 1
        },
        {
          "operation": "force-merge",
          "clients": 1
        },
        {
          "name": "refresh-after-force-merge",
          "operation": "refresh",
          "clients": 1
        },
        {
          "operation": "default",
          "clients": 1,
          "warmup-iterations": 500,
          "iterations": 100,
          "target-throughput": 8
        },
        {
          "operation": "term",
          "clients": 1,
          "warmup-iterations": 500,
          "iterations": 100,
          "target-throughput": 50
        },
        {
          "operation": "range",
          "clients": 1,
          "warmup-iterations": 100,
          "iterations": 100,
          "target-throughput": 1
        },
        {
          "operation": "hourly_agg",
          "clients": 1,
          "warmup-iterations": 100,
          "iterations": 100,
          "target-throughput": 0.2
        },
        {
          "operation": "scroll",
          "clients": 1,
          "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
        }
      ]
    },
    {
      "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",
          "clients": 1
        },
        {
          "operation": "force-merge",
          "clients": 1
        },
        {
          "name": "refresh-after-force-merge",
          "operation": "refresh",
          "clients": 1
        }
      ]
    },
    {
      "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",
          "clients": 1
        },
        {
          "operation": "force-merge",
          "clients": 1
        },
        {
          "name": "refresh-after-force-merge",
          "operation": "refresh",
          "clients": 1
        }
      ]
    }

chanllenges.json就是operations的有序集合,定义了一个压测方案,这个压测方案该怎么去做。

3、执行压测方案(Team/Car)

1、Rally管理

Rally自己的Car在 ~/.rally/benchmarks/teams/default/cars当中

car其实就是在改elasticsearch.yml的配置文件,根据不同的配置文件来进行压测

2、Race

4、总结并产出压测报告

  • 可以通过日志查看到每次输出的结果报告,路径为~/.rally/logs
  • 可以通过json查看到每次输出的结果报告,路径为~/.rally//benchmarks/races

四、Race结果分析

------------------------------------------------------
    _______             __   _____
   / ____(_)___  ____ _/ /  / ___/_________  ________
  / /_  / / __ \/ __ `/ /   \__ \/ ___/ __ \/ ___/ _ \
 / __/ / / / / / /_/ / /   ___/ / /__/ /_/ / /  /  __/
/_/   /_/_/ /_/\__,_/_/   /____/\___/\____/_/   \___/
------------------------------------------------------
            
|                                                         Metric |                   Task |       Value |    Unit |
|---------------------------------------------------------------:|-----------------------:|------------:|--------:|
|                     Cumulative indexing time of primary shards |                        |      0.0524 |     min |
|             Min cumulative indexing time across primary shards |                        |     0.00345 |     min |
|          Median cumulative indexing time across primary shards |                        |     0.00705 |     min |
|             Max cumulative indexing time across primary shards |                        |      0.0285 |     min |
|            Cumulative indexing throttle time of primary shards |                        |           0 |     min |
|    Min cumulative indexing throttle time across primary shards |                        |           0 |     min |
| Median cumulative indexing throttle time across primary shards |                        |           0 |     min |
|    Max cumulative indexing throttle time across primary shards |                        |           0 |     min |
|                        Cumulative merge time of primary shards |                        |  0.00121667 |     min |
|                       Cumulative merge count of primary shards |                        |           1 |         |
|                Min cumulative merge time across primary shards |                        |           0 |     min |
|             Median cumulative merge time across primary shards |                        |           0 |     min |
|                Max cumulative merge time across primary shards |                        |  0.00121667 |     min |
|               Cumulative merge throttle time of primary shards |                        |           0 |     min |
|       Min cumulative merge throttle time across primary shards |                        |           0 |     min |
|    Median cumulative merge throttle time across primary shards |                        |           0 |     min |
|       Max cumulative merge throttle time across primary shards |                        |           0 |     min |
|                      Cumulative refresh time of primary shards |                        |   0.0147667 |     min |
|                     Cumulative refresh count of primary shards |                        |          28 |         |
|              Min cumulative refresh time across primary shards |                        |      0.0008 |     min |
|           Median cumulative refresh time across primary shards |                        |  0.00118333 |     min |
|              Max cumulative refresh time across primary shards |                        |   0.0106833 |     min |
|                        Cumulative flush time of primary shards |                        |           0 |     min |
|                       Cumulative flush count of primary shards |                        |           0 |         |
|                Min cumulative flush time across primary shards |                        |           0 |     min |
|             Median cumulative flush time across primary shards |                        |           0 |     min |
|                Max cumulative flush time across primary shards |                        |           0 |     min |
|                                             Total Young Gen GC |                        |       1.041 |       s |
|                                               Total Old Gen GC |                        |       0.077 |       s |
|                                                     Store size |                        | 0.000477083 |      GB |
|                                                  Translog size |                        | 2.00234e-07 |      GB |
|                                                     Index size |                        | 0.000479033 |      GB |
|                                                  Total written |                        |  0.00526047 |      GB |
|                                         Heap used for segments |                        |    0.144107 |      MB |
|                                       Heap used for doc values |                        |   0.0289612 |      MB |
|                                            Heap used for terms |                        |    0.098547 |      MB |
|                                            Heap used for norms |                        |   0.0111694 |      MB |
|                                           Heap used for points |                        | 8.86917e-05 |      MB |
|                                    Heap used for stored fields |                        |  0.00534058 |      MB |
|                                                  Segment count |                        |          18 |         |
|                                                 Min Throughput |           index-append |     1570.05 |  docs/s |
|                                              Median Throughput |           index-append |     1570.05 |  docs/s |
|                                                 Max Throughput |           index-append |     1570.05 |  docs/s |
|                                        50th percentile latency |           index-append |     493.594 |      ms |
|                                       100th percentile latency |           index-append |     640.284 |      ms |
|                                   50th percentile service time |           index-append |     493.594 |      ms |
|                                  100th percentile service time |           index-append |     640.284 |      ms |
|                                                     error rate |           index-append |           0 |       % |
|                                                 Min Throughput |            index-stats |      101.66 |   ops/s |
|                                              Median Throughput |            index-stats |      101.66 |   ops/s |
|                                                 Max Throughput |            index-stats |      101.66 |   ops/s |
|                                       100th percentile latency |            index-stats |      3.8636 |      ms |
|                                  100th percentile service time |            index-stats |      3.8636 |      ms |
|                                                     error rate |            index-stats |           0 |       % |
|                                                 Min Throughput |             node-stats |      133.92 |   ops/s |
|                                              Median Throughput |             node-stats |      133.92 |   ops/s |
|                                                 Max Throughput |             node-stats |      133.92 |   ops/s |
|                                       100th percentile latency |             node-stats |     4.26146 |      ms |
|                                  100th percentile service time |             node-stats |     4.26146 |      ms |
|                                                     error rate |             node-stats |           0 |       % |
|                                                 Min Throughput |                default |       34.59 |   ops/s |
|                                              Median Throughput |                default |       34.59 |   ops/s |
|                                                 Max Throughput |                default |       34.59 |   ops/s |
|                                       100th percentile latency |                default |     5.76604 |      ms |
|                                  100th percentile service time |                default |     5.76604 |      ms |
|                                                     error rate |                default |           0 |       % |
|                                                 Min Throughput |                   term |      132.35 |   ops/s |
|                                              Median Throughput |                   term |      132.35 |   ops/s |
|                                                 Max Throughput |                   term |      132.35 |   ops/s |
|                                       100th percentile latency |                   term |     3.43632 |      ms |
|                                  100th percentile service time |                   term |     3.43632 |      ms |
|                                                     error rate |                   term |           0 |       % |
|                                                 Min Throughput |                 phrase |      107.66 |   ops/s |
|                                              Median Throughput |                 phrase |      107.66 |   ops/s |
|                                                 Max Throughput |                 phrase |      107.66 |   ops/s |
|                                       100th percentile latency |                 phrase |       3.054 |      ms |
|                                  100th percentile service time |                 phrase |       3.054 |      ms |
|                                                     error rate |                 phrase |           0 |       % |
|                                                 Min Throughput |   country_agg_uncached |       27.85 |   ops/s |
|                                              Median Throughput |   country_agg_uncached |       27.85 |   ops/s |
|                                                 Max Throughput |   country_agg_uncached |       27.85 |   ops/s |
|                                       100th percentile latency |   country_agg_uncached |     4.45422 |      ms |
|                                  100th percentile service time |   country_agg_uncached |     4.45422 |      ms |
|                                                     error rate |   country_agg_uncached |           0 |       % |
|                                                 Min Throughput |     country_agg_cached |      109.32 |   ops/s |
|                                              Median Throughput |     country_agg_cached |      109.32 |   ops/s |
|                                                 Max Throughput |     country_agg_cached |      109.32 |   ops/s |
|                                       100th percentile latency |     country_agg_cached |     5.99433 |      ms |
|                                  100th percentile service time |     country_agg_cached |     5.99433 |      ms |
|                                                     error rate |     country_agg_cached |           0 |       % |
|                                                 Min Throughput |                 scroll |       29.65 | pages/s |
|                                              Median Throughput |                 scroll |       29.65 | pages/s |
|                                                 Max Throughput |                 scroll |       29.65 | pages/s |
|                                       100th percentile latency |                 scroll |     40.1824 |      ms |
|                                  100th percentile service time |                 scroll |     40.1824 |      ms |
|                                                     error rate |                 scroll |           0 |       % |
|                                                 Min Throughput |             expression |       11.13 |   ops/s |
|                                              Median Throughput |             expression |       11.13 |   ops/s |
|                                                 Max Throughput |             expression |       11.13 |   ops/s |
|                                       100th percentile latency |             expression |     3.80491 |      ms |
|                                  100th percentile service time |             expression |     3.80491 |      ms |
|                                                     error rate |             expression |           0 |       % |
|                                                 Min Throughput |        painless_static |       10.41 |   ops/s |
|                                              Median Throughput |        painless_static |       10.41 |   ops/s |
|                                                 Max Throughput |        painless_static |       10.41 |   ops/s |
|                                       100th percentile latency |        painless_static |     9.01236 |      ms |
|                                  100th percentile service time |        painless_static |     9.01236 |      ms |
|                                                     error rate |        painless_static |           0 |       % |
|                                                 Min Throughput |       painless_dynamic |       25.16 |   ops/s |
|                                              Median Throughput |       painless_dynamic |       25.16 |   ops/s |
|                                                 Max Throughput |       painless_dynamic |       25.16 |   ops/s |
|                                       100th percentile latency |       painless_dynamic |     5.22466 |      ms |
|                                  100th percentile service time |       painless_dynamic |     5.22466 |      ms |
|                                                     error rate |       painless_dynamic |           0 |       % |
|                                                 Min Throughput |            large_terms |        0.79 |   ops/s |
|                                              Median Throughput |            large_terms |        0.79 |   ops/s |
|                                                 Max Throughput |            large_terms |        0.79 |   ops/s |
|                                       100th percentile latency |            large_terms |     1003.01 |      ms |
|                                  100th percentile service time |            large_terms |     1003.01 |      ms |
|                                                     error rate |            large_terms |           0 |       % |
|                                                 Min Throughput |   large_filtered_terms |        2.59 |   ops/s |
|                                              Median Throughput |   large_filtered_terms |        2.59 |   ops/s |
|                                                 Max Throughput |   large_filtered_terms |        2.59 |   ops/s |
|                                       100th percentile latency |   large_filtered_terms |     221.965 |      ms |
|                                  100th percentile service time |   large_filtered_terms |     221.965 |      ms |
|                                                     error rate |   large_filtered_terms |           0 |       % |
|                                                 Min Throughput | large_prohibited_terms |        7.73 |   ops/s |
|                                              Median Throughput | large_prohibited_terms |        7.73 |   ops/s |
|                                                 Max Throughput | large_prohibited_terms |        7.73 |   ops/s |
|                                       100th percentile latency | large_prohibited_terms |     121.091 |      ms |
|                                  100th percentile service time | large_prohibited_terms |     121.091 |      ms |
|                                                     error rate | large_prohibited_terms |           0 |       % |


--------------------------------
[INFO] SUCCESS (took 74 seconds)
--------------------------------
  • Metric:具体指标
  • Task:操作名称
  • Value:数值
  • Unit:单位

注意:在Task当中,有空和具体操作名称的区分,如果是空的则表示总计的结果,如果有具体操作名称的则是记录该次操作的结果

Mertic具体指标详解

第一、time:Index | Merge | Refresh | Flush => 对应操作花费的总时间

第二、GC:Young | Total => GC花费的时间

第三、Index size | Total written => 最终索引总大小和实际写入处理的大小

第四、Heap:doc values | terms | norms => 堆内存占用情况

第五、Operation:

  • Throughput   =>   当前操作的吞吐情况
  • Latency   =>   当前操作的延迟时长(请求到达ES,然后从ES返回的时间,包含了排队的时间)
  • Service Time   =>   当前操作的服务时间(ES开始执行请求到结束的时间)

五、应用场景

1、如何对比ES5.5.0相比2.4.6的性能改进

第一步:先测试2.4.6的性能

esrally race --distribution-version=2.4.6 --track=nyc_taxis --challenge=append-no-conflicts

第二步:再测试5.5.0的性能

esrally race --distribution-version=5.5.0 --track=nyc_taxis --challenge=append-no-conflicts

第三步:对比两次race的结果

esrally list races #查看已有结果
esrally compare --baseline=[2.4.6 race] --contender=[5.5.0 race] #对比结果,以2.4.6版本为基准

2、如何测试_all关闭后对于写性能的影响

第一步:默认nyc_taxis的mappings设置是将_all关闭的,直接测试_all关闭时的性能

esrally race --disrtibution-version=5.5.0 --track=nyc_taxis --challenge=append-no-conflicts --include-tasks="type:index"

第二步:修改nyc_taxis的mapping设置,打开_all

~/.rally/benchmarks/tracks/default/nuc_taxis/mappings.json

第三步:测试打开_all后的性能

esrally race --disrtibution-version=5.5.0 --track=nyc_taxis --challenge=append-no-conflicts --include-tasks="type:index"

第四步:对比两次race的结果

esrally list races #查看已有结果
esrally compare --baseline=[enableAll race] --contender=[disableAll race] #对比结果,以打开_all版本结果为基准

 


版权声明:本文为BearStarX原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。