Skip to content

流水数据写 ES 压测

压测工具 esrally

  • 编写脚本,生成测试数据 JSONEachRow
bash
esrally --track-path=~/track/10m_kd/ \
 --pipeline=benchmark-only \
 --target-hosts=10.111.3.19:9200,10.111.3.20:9200,10.111.3.21:9200 \
 --offline \
 --report-file=/tmp/report-10m.md

压测报告

报告名词解释

http://esrally.lyremelody.org/zh_CN/latest/summary_report.html

压测方法

  • query-match-all-10k 一次查询 10k 条数据

10,000,000 压测一千万数据(2G)

MetricTaskValueUnit
Cumulative indexing time of primary shards926.319min
Min cumulative indexing time across primary shards0min
Median cumulative indexing time across primary shards0min
Max cumulative indexing time across primary shards189.715min
Cumulative indexing throttle time of primary shards0min
Min cumulative indexing throttle time across primary shards0min
Median cumulative indexing throttle time across primary shards0min
Max cumulative indexing throttle time across primary shards0min
Cumulative merge time of primary shards444.689min
Cumulative merge count of primary shards449
Min cumulative merge time across primary shards0min
Median cumulative merge time across primary shards0min
Max cumulative merge time across primary shards342.369min
Cumulative merge throttle time of primary shards48.5922min
Min cumulative merge throttle time across primary shards0min
Median cumulative merge throttle time across primary shards0min
Max cumulative merge throttle time across primary shards26.4601min
Cumulative refresh time of primary shards162.56min
Cumulative refresh count of primary shards7592
Min cumulative refresh time across primary shards0min
Median cumulative refresh time across primary shards0min
Max cumulative refresh time across primary shards4.42518min
Cumulative flush time of primary shards36.3231min
Cumulative flush count of primary shards842
Min cumulative flush time across primary shards0min
Median cumulative flush time across primary shards0min
Max cumulative flush time across primary shards12.215min
Total Young Gen GC29.81s
Total Old Gen GC0s
Store size600.827GB
Translog size3.4729e-05GB
Heap used for segments19.9MB
Heap used for doc values8.05996MB
Heap used for terms5.51184MB
Heap used for norms0.49292MB
Heap used for points0MB
Heap used for stored fields5.83527MB
Segment count6366
Min Throughputbulk32419.2docs/s
Median Throughputbulk34948.8docs/s
Max Throughputbulk35597docs/s
50th percentile latencybulk544.618ms
90th percentile latencybulk852.475ms
99th percentile latencybulk6567.99ms
100th percentile latencybulk10029.2ms
50th percentile service timebulk544.618ms
90th percentile service timebulk852.475ms
99th percentile service timebulk6567.99ms
100th percentile service timebulk10029.2ms
error ratebulk0%
Min Throughputquery-match-all100.02ops/s
Median Throughputquery-match-all100.03ops/s
Max Throughputquery-match-all100.06ops/s
50th percentile latencyquery-match-all3.23969ms
90th percentile latencyquery-match-all4.42155ms
99th percentile latencyquery-match-all18.7788ms
99.9th percentile latencyquery-match-all50.5065ms
100th percentile latencyquery-match-all61.5432ms
50th percentile service timequery-match-all3.13218ms
90th percentile service timequery-match-all4.19813ms
99th percentile service timequery-match-all14.7171ms
99.9th percentile service timequery-match-all43.7854ms
100th percentile service timequery-match-all61.4653ms
error ratequery-match-all0%
Min Throughputquery-match-all-10k4.83ops/s
Median Throughputquery-match-all-10k4.86ops/s
Max Throughputquery-match-all-10k4.86ops/s
50th percentile latencyquery-match-all-10k880963ms
90th percentile latencyquery-match-all-10k1.11775e+06ms
99th percentile latencyquery-match-all-10k1.17266e+06ms
99.9th percentile latencyquery-match-all-10k1.18024e+06ms
100th percentile latencyquery-match-all-10k1.18133e+06ms
50th percentile service timequery-match-all-10k608.404ms
90th percentile service timequery-match-all-10k749.748ms
99th percentile service timequery-match-all-10k886.041ms
99.9th percentile service timequery-match-all-10k1013.36ms
100th percentile service timequery-match-all-10k1036.93ms
error ratequery-match-all-10k0%

20,000,000 压测两千万数据(6G)

MetricTaskValueUnit
Cumulative indexing time of primary shards942.175min
Min cumulative indexing time across primary shards0min
Median cumulative indexing time across primary shards0min
Max cumulative indexing time across primary shards189.715min
Cumulative indexing throttle time of primary shards0min
Min cumulative indexing throttle time across primary shards0min
Median cumulative indexing throttle time across primary shards0min
Max cumulative indexing throttle time across primary shards0min
Cumulative merge time of primary shards449.05min
Cumulative merge count of primary shards453
Min cumulative merge time across primary shards0min
Median cumulative merge time across primary shards0min
Max cumulative merge time across primary shards342.369min
Cumulative merge throttle time of primary shards49.1307min
Min cumulative merge throttle time across primary shards0min
Median cumulative merge throttle time across primary shards0min
Max cumulative merge throttle time across primary shards26.4601min
Cumulative refresh time of primary shards164.416min
Cumulative refresh count of primary shards7604
Min cumulative refresh time across primary shards0min
Median cumulative refresh time across primary shards0min
Max cumulative refresh time across primary shards4.42518min
Cumulative flush time of primary shards36.7088min
Cumulative flush count of primary shards848
Min cumulative flush time across primary shards0min
Median cumulative flush time across primary shards0min
Max cumulative flush time across primary shards12.215min
Total Young Gen GC48.762s
Total Old Gen GC0s
Store size603.832GB
Translog size3.4729e-05GB
Heap used for segments20.0072MB
Heap used for doc values8.07825MB
Heap used for terms5.56839MB
Heap used for norms0.499146MB
Heap used for points0MB
Heap used for stored fields5.86143MB
Segment count6400
Min Throughputbulk34692.8docs/s
Median Throughputbulk37088.2docs/s
Max Throughputbulk40048.1docs/s
50th percentile latencybulk604.131ms
90th percentile latencybulk1000.26ms
99th percentile latencybulk6933.49ms
99.9th percentile latencybulk9321.29ms
100th percentile latencybulk10969.2ms
50th percentile service timebulk604.131ms
90th percentile service timebulk1000.26ms
99th percentile service timebulk6933.49ms
99.9th percentile service timebulk9321.29ms
100th percentile service timebulk10969.2ms
error ratebulk0%
Min Throughputquery-match-all99.96ops/s
Median Throughputquery-match-all99.99ops/s
Max Throughputquery-match-all100ops/s
50th percentile latencyquery-match-all18.0637ms
90th percentile latencyquery-match-all22.6536ms
99th percentile latencyquery-match-all25.7546ms
99.9th percentile latencyquery-match-all52.2396ms
100th percentile latencyquery-match-all80.3291ms
50th percentile service timequery-match-all12.5858ms
90th percentile service timequery-match-all13.1015ms
99th percentile service timequery-match-all14.5955ms
99.9th percentile service timequery-match-all36.1591ms
100th percentile service timequery-match-all80.0038ms
error ratequery-match-all0%
Min Throughputquery-match-all-10k4.8ops/s
Median Throughputquery-match-all-10k4.83ops/s
Max Throughputquery-match-all-10k4.84ops/s
50th percentile latencyquery-match-all-10k885599ms
90th percentile latencyquery-match-all-10k1.12163e+06ms
99th percentile latencyquery-match-all-10k1.17445e+06ms
99.9th percentile latencyquery-match-all-10k1.17983e+06ms
100th percentile latencyquery-match-all-10k1.18078e+06ms
50th percentile service timequery-match-all-10k606.899ms
90th percentile service timequery-match-all-10k733.711ms
99th percentile service timequery-match-all-10k903.01ms
99.9th percentile service timequery-match-all-10k1068.78ms
100th percentile service timequery-match-all-10k1120.69ms
error ratequery-match-all-10k0%

50,000,000 压测两千万数据(14.9gb)

MetricTaskValueUnit
Cumulative indexing time of primary shards1004.26min
Min cumulative indexing time across primary shards0min
Median cumulative indexing time across primary shards0min
Max cumulative indexing time across primary shards189.715min
Cumulative indexing throttle time of primary shards0min
Min cumulative indexing throttle time across primary shards0min
Median cumulative indexing throttle time across primary shards0min
Max cumulative indexing throttle time across primary shards0min
Cumulative merge time of primary shards481.161min
Cumulative merge count of primary shards513
Min cumulative merge time across primary shards0min
Median cumulative merge time across primary shards0min
Max cumulative merge time across primary shards342.369min
Cumulative merge throttle time of primary shards55.9592min
Min cumulative merge throttle time across primary shards0min
Median cumulative merge throttle time across primary shards0min
Max cumulative merge throttle time across primary shards26.4601min
Cumulative refresh time of primary shards170.947min
Cumulative refresh count of primary shards7850
Min cumulative refresh time across primary shards0min
Median cumulative refresh time across primary shards0min
Max cumulative refresh time across primary shards4.42518min
Cumulative flush time of primary shards39.1434min
Cumulative flush count of primary shards869
Min cumulative flush time across primary shards0min
Median cumulative flush time across primary shards0min
Max cumulative flush time across primary shards12.215min
Total Young Gen GC130.536s
Total Old Gen GC0s
Store size612.732GB
Translog size3.4729e-05GB
Heap used for segments20.0694MB
Heap used for doc values8.07607MB
Heap used for terms5.59167MB
Heap used for norms0.501709MB
Heap used for points0MB
Heap used for stored fields5.8999MB
Segment count6414
Min Throughputbulk37718.2docs/s
Median Throughputbulk39696.5docs/s
Max Throughputbulk47263.3docs/s
50th percentile latencybulk1785.51ms
90th percentile latencybulk3012.87ms
99th percentile latencybulk8610.95ms
99.9th percentile latencybulk13259.1ms
100th percentile latencybulk14838.4ms
50th percentile service timebulk1785.51ms
90th percentile service timebulk3012.87ms
99th percentile service timebulk8610.95ms
99.9th percentile service timebulk13259.1ms
100th percentile service timebulk14838.4ms
error ratebulk0%
Min Throughputquery-match-all99.87ops/s
Median Throughputquery-match-all100.01ops/s
Max Throughputquery-match-all100.01ops/s
50th percentile latencyquery-match-all3.62666ms
90th percentile latencyquery-match-all4.67795ms
99th percentile latencyquery-match-all90.2625ms
99.9th percentile latencyquery-match-all267.873ms
100th percentile latencyquery-match-all289.898ms
50th percentile service timequery-match-all3.37023ms
90th percentile service timequery-match-all4.41682ms
99th percentile service timequery-match-all17.8509ms
99.9th percentile service timequery-match-all230.215ms
100th percentile service timequery-match-all277.346ms
error ratequery-match-all0%
Min Throughputquery-match-all-10k4.86ops/s
Median Throughputquery-match-all-10k4.86ops/s
Max Throughputquery-match-all-10k4.87ops/s
50th percentile latencyquery-match-all-10k880695ms
90th percentile latencyquery-match-all-10k1.11436e+06ms
99th percentile latencyquery-match-all-10k1.16724e+06ms
99.9th percentile latencyquery-match-all-10k1.17362e+06ms
100th percentile latencyquery-match-all-10k1.17412e+06ms
50th percentile service timequery-match-all-10k608.759ms
90th percentile service timequery-match-all-10k734.927ms
99th percentile service timequery-match-all-10k885.9ms
99.9th percentile service timequery-match-all-10k1006.49ms
100th percentile service timequery-match-all-10k1126.4ms
error ratequery-match-all-10k0%

配置

track.json

json
{% import "rally.helpers" as rally with context %}

{
  "version": 2,
  "description": "StackOverflow Q&A stored as nested docs",
  "indices": [
    {
      "name": "sonested",
      "body": "index.json"
    }
  ],
  "corpora": [
    {
      "name": "nested",
      "documents": [
        {
          "source-file": "documents.json",
          "document-count": 50000000,
          "uncompressed-bytes": 10590359571
        }
      ]
    }
  ],
  "challenges": [
    {
      "name": "2-index-and-query",
      "default": true,
      "schedule": [
        {
          "operation": {
            "operation-type": "delete-index"
          }
        },
        {
          "operation": {
            "operation-type": "create-index"
          }
        },
        {
          "operation": {
            "operation-type": "cluster-health",
            "request-params": {
              "wait_for_status": "green"
            }
          }
        },
        {
          "operation": {
            "operation-type": "bulk",
            "bulk-size": 10000
          },
          "warmup-time-period": 120,
          "clients": 8
        },
        {
          "operation": {
            "operation-type": "force-merge"
          }
        },
        {
          "operation": {
            "name": "query-match-all",
            "operation-type": "search",
            "body": {
              "query": {
                "match_all": {}
              }
            }
          },
          "clients": 8,
          "warmup-iterations": 1000,
          "iterations": 1000,
          "target-throughput": 100
        },
	{
          "operation": {
            "name": "query-match-all-10k",
            "operation-type": "search",
            "body": {
	      "size": 10000,
              "query": {
                "match_all": {}
              }
            }
          },
          "clients": 3,
          "warmup-iterations": 1000,
          "iterations": 1000,
          "target-throughput": 100
        }
      ]
    }
  ]
}

index.json

json
{
  "settings": {
    "index.number_of_shards": {{number_of_shards | default(5)}},
    "index.number_of_replicas": {{number_of_replicas | default(0)}},
    "index.store.type": "{{store_type | default('fs')}}",
    "index.requests.cache.enable": false
  },
  "mappings" : {
    "properties" : {
      "cFree" : {
        "type" : "long"
      },
      "cTotal" : {
        "type" : "long"
      },
      "direction" : {
        "type" : "long"
      },
      "free" : {
        "type" : "long"
      },
      "id" : {
        "type" : "text",
        "fields" : {
          "keyword" : {
            "type" : "keyword",
            "ignore_above" : 256
          }
        }
      },
      "relId" : {
        "type" : "text",
        "fields" : {
          "keyword" : {
            "type" : "keyword",
            "ignore_above" : 256
          }
        }
      },
      "time" : {
        "type" : "long"
      },
      "total" : {
        "type" : "long"
      },
      "type" : {
        "type" : "text",
        "fields" : {
          "keyword" : {
            "type" : "keyword",
            "ignore_above" : 256
          }
        }
      },
      "user" : {
        "type" : "long"
      }
    }
  }
}

参考资料

  1. Rally 官方文档