Elastic search performance testing finding

Setup
1 Node cluster on my local laptop: 8core, Xms=8G, Xmx=8G

Indexing performance (Single index):
10 million payments, each one about 5KB, with batch size = 10000. Each batch takes roughly 2.5 s → 4 s, total time to index 10 million payment is around 50 min

Indexing performance (Multiple indices):
20 separate indices store totally 10 million payments. Indexing execution is slightly faster than single index case. Each batch takes roughly 1.7 s → 3.8 s, total time to index 10 million payment is around 38 min

Parameters required for bulk load operation
Elasticsearch config: http.max_content_length: 500mb

Client time out adjustment:

RestClient.builder(HttpHost("localhost", 9200))
        .setRequestConfigCallback {
    it.apply {
        this.setConnectTimeout(5000)
        this.setSocketTimeout(60000)
    }
}.setMaxRetryTimeoutMillis(60000))

Initially batch size is set to 100000, elastic search server becomes unstable with high GC frequency, occupying a large percent of CPU time. So larger batch size does not always imply higher performance

Query aggregation performance:

Test query: real aggregation query used by rule engine

{
  "aggregations": {
    "date_range": {
      "range": {
        "field": "createdAt",
        "ranges": [
          {
            "key": "LAST_7_DAYS",
            "from": 1544400968485,
            "to": 1545005768486
          }
        ],
        "keyed": false
      },
      "aggregations": {
        "filter_aggregator": {
          "filters": {
            "filters": {
              "602c7d66-e990-4dfb-b6e2-72b62ff159d5": {
                "terms": {
                  "beneficiaryId.keyword": [
                    "602c7d66-e990-4dfb-b6e2-72b62ff159d5"
                  ],
                  "boost": 1
                }
              },
              "67cab0c8-2510-443d-8f00-bce19c04815e": {
                "terms": {
                  "bankAccountUserId.keyword": [
                    "67cab0c8-2510-443d-8f00-bce19c04815e"
                  ],
                  "boost": 1
                }
              },
              "8da52e51-eabf-4f6c-b9f0-e222933c1cb7": {
                "terms": {
                  "payerId.keyword": [
                    "8da52e51-eabf-4f6c-b9f0-e222933c1cb7"
                  ],
                  "boost": 1
                }
              },
              "8da52e51-eabf-4f6c-b9f0-e222933c1cb7_602c7d66-e990-4dfb-b6e2-72b62ff159d5": {
                "bool": {
                  "filter": [
                    {
                      "terms": {
                        "payerId.keyword": [
                          "8da52e51-eabf-4f6c-b9f0-e222933c1cb7"
                        ],
                        "boost": 1
                      }
                    },
                    {
                      "terms": {
                        "beneficiaryId.keyword": [
                          "602c7d66-e990-4dfb-b6e2-72b62ff159d5"
                        ],
                        "boost": 1
                      }
                    }
                  ],
                  "adjust_pure_negative": true,
                  "boost": 1
                }
              },
              "9a1b4bad-ccf5-4c67-8718-02696cb351e4": {
                "terms": {
                  "clientId.keyword": [
                    "9a1b4bad-ccf5-4c67-8718-02696cb351e4"
                  ],
                  "boost": 1
                }
              },
              "9a1b4bad-ccf5-4c67-8718-02696cb351e4_602c7d66-e990-4dfb-b6e2-72b62ff159d5": {
                "bool": {
                  "filter": [
                    {
                      "terms": {
                        "clientId.keyword": [
                          "9a1b4bad-ccf5-4c67-8718-02696cb351e4"
                        ],
                        "boost": 1
                      }
                    },
                    {
                      "terms": {
                        "beneficiaryId.keyword": [
                          "602c7d66-e990-4dfb-b6e2-72b62ff159d5"
                        ],
                        "boost": 1
                      }
                    }
                  ],
                  "adjust_pure_negative": true,
                  "boost": 1
                }
              },
              "9a1b4bad-ccf5-4c67-8718-02696cb351e4_8da52e51-eabf-4f6c-b9f0-e222933c1cb7": {
                "bool": {
                  "filter": [
                    {
                      "terms": {
                        "clientId.keyword": [
                          "9a1b4bad-ccf5-4c67-8718-02696cb351e4"
                        ],
                        "boost": 1
                      }
                    },
                    {
                      "terms": {
                        "payerId.keyword": [
                          "8da52e51-eabf-4f6c-b9f0-e222933c1cb7"
                        ],
                        "boost": 1
                      }
                    }
                  ],
                  "adjust_pure_negative": true,
                  "boost": 1
                }
              },
              "9a1b4bad-ccf5-4c67-8718-02696cb351e4_8da52e51-eabf-4f6c-b9f0-e222933c1cb7_602c7d66-e990-4dfb-b6e2-72b62ff159d5": {
                "bool": {
                  "filter": [
                    {
                      "terms": {
                        "clientId.keyword": [
                          "9a1b4bad-ccf5-4c67-8718-02696cb351e4"
                        ],
                        "boost": 1
                      }
                    },
                    {
                      "terms": {
                        "payerId.keyword": [
                          "8da52e51-eabf-4f6c-b9f0-e222933c1cb7"
                        ],
                        "boost": 1
                      }
                    },
                    {
                      "terms": {
                        "beneficiaryId.keyword": [
                          "602c7d66-e990-4dfb-b6e2-72b62ff159d5"
                        ],
                        "boost": 1
                      }
                    }
                  ],
                  "adjust_pure_negative": true,
                  "boost": 1
                }
              }
            },
            "other_bucket": false,
            "other_bucket_key": "_other_"
          },
          "aggregations": {
            "beneficiary_amount": {
              "stats": {
                "field": "beneficiaryAmountUsd"
              }
            },
            "payer_amount": {
              "stats": {
                "field": "payerAmountUsd"
              }
            },
            "distinct_count_beneficiary": {
              "cardinality": {
                "field": "beneficiaryId.keyword"
              }
            },
            "distinct_count_payer": {
              "cardinality": {
                "field": "payerId.keyword"
              }
            },
            "distinct_count_client": {
              "cardinality": {
                "field": "clientId.keyword"
              }
            },
            "distinct_count_bank_acc": {
              "cardinality": {
                "field": "bankAccountUserId.keyword"
              }
            },
            "distinct_count_bene_country": {
              "cardinality": {
                "field": "beneficiaryCountry.keyword"
              }
            },
            "distinct_count_payer_country": {
              "cardinality": {
                "field": "payerCountry.keyword"
              }
            },
            "distinct_count_bene_currency": {
              "cardinality": {
                "field": "beneficiaryCurrency.keyword"
              }
            },
            "distinct_count_payer_currency": {
              "cardinality": {
                "field": "payerCurrency.keyword"
              }
            },
            "structured_payment_amount_personal": {
              "range": {
                "field": "payerAmountUsd",
                "ranges": [
                  {
                    "from": 9000,
                    "to": 9999.999
                  }
                ],
                "keyed": false
              }
            },
            "structured_payment_amount_company": {
              "range": {
                "field": "payerAmountUsd",
                "ranges": [
                  {
                    "from": 112500000,
                    "to": 124999999.999
                  }
                ],
                "keyed": false
              }
            }
          }
        }
      }
    }
  }
}

Test result : (Single Index)

Scenario Number of run Execution times Min Max Average
Single thread<br/>Search result hit<br/>Result size unset<br/> 10 Text

Conclusion:
Aggregation performance hinges on the number of documents that matches the aggregation?

Result size parameter has significant impact on aggregation performance. not only because it skipped returning hit documents, but also because it enables caching for aggregation result, otherwise, you have to force result caching by explicitly setting?request_cache=true

https://www.elastic.co/guide/en/elasticsearch/reference/6.6/shard-request-cache.html

Executing query concurrently can also have negative impact on performance

Increasing number of indices have positive impact on index speed but have large negative impact on aggregation if the aggregation is performed across indices

原文地址:https://blog.51cto.com/shadowisper/2429085

时间: 2024-10-07 15:01:17

Elastic search performance testing finding的相关文章

elastic search查询命令集合

Technorati 标签: elastic search,query,commands 基本查询:最简单的查询方式 query:{"term":{"title":"crime"}} terms:目标列包含指定词 match:会把输入的"短语"进行分解成词 bool match:match分解成多个词,并且是and的关系,默认是or的关系 match phrase:分词,但是要指定分词之间词语的个数 match phrase

elastic search 学习笔记

Elastic search在数据分析的应用中相当于一个数据库的搜索引擎. 跟MySQL类似,它有自己的查询语言,只不过不是关系型数据库,属于NoSQL. 可以根据索引从分布式服务器文件系统中快速存取数据.mysql的数据库和表存放在某台服务器上,使用的时候连接到服务器对数据库进行操作,数据使用unicode编码的mysql raw data格式:而elasticsearch通过http使用json数据进行数据索引.

Elastic Search 相关度计算

为了搞清楚elastic search背后是如何计算文档搜索时候的相关度,我决定自己做实验去探索 这篇博客讲得还不错 http://blog.csdn.net/dm_vincent/article/details/42099063 而博客本身也只是翻译了官方文档 https://www.elastic.co/guide/en/elasticsearch/guide/current/scoring-theory.html 我准备验证一下 在进行文档的搜索时,应用了以下几个基础算法的组合.名字听起来

ELASTIC SEARCH 安装

elastic search 2017年3月18日 安装&使用 环境 表 1 环境信息 Centos cat /etc/issue CentOS release 6.8 (Final) cat /proc/version Linux version 2.6.32-431.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) ) #1 SMP Fri Nov 22 03:15:09 UT

[elastic search][redis] 初试 ElasticSearch / redis

现有项目组,工作需要. http://www.cnblogs.com/xing901022/p/4704319.html Elastic Search权威指南(中文版) https://es.xiaoleilu.com/010_Intro/00_README.html https://www.elastic.co/guide/cn/elasticsearch/guide/current/index.html https://github.com/elastic/elasticsearch Ela

Elastic Search如何快速检索

Elastic Search如何快速检索 http://www.infoq.com/cn/articles/database-timestamp-02 Elasticsearch是通过Lucene的倒排索引技术实现比关系型数据库更快的过滤.特别是它对多条件的过滤支持非常好,比如年龄在18和30之间,性别为女性这样的组合查询.倒排索引很多地方都有介绍,但是其比关系型数据库的b-tree索引快在哪里?到底为什么快呢? 笼统的来说,b-tree索引是为写入优化的索引结构.当我们不需要支持快速的更新的时

Elastic Search搜索引擎在SpringBoot中的实践

实验环境 ES版本:5.3.0 spring bt版本:1.5.9 首先当然需要安装好elastic search环境,最好再安装上可视化插件 elasticsearch-head来便于我们直观地查看数据. 当然这部分可以参考本人的帖子:<centos7上elastic search安装填坑记>https://www.jianshu.com/p/04f4d7b4a1d3 我的ES安装在http://113.209.119.170:9200/这个地址(该地址需要配到springboot项目中去)

elastic search文档详解

在elastic search中文档(document)类似于关系型数据库里的记录(record),类型(type)类似于表(table),索引(index)类似于库(database). 文档一定有三个元数据 _index 文档在哪存放 _type 文档表示的对象类别 _id 文档唯一标识 _index可以理解为数据库,在elastic search中通常是将格式相同的数据存在同一_index下,_type即将取消,以后不同type建议分为不同_index,_id类似于数据库里的主键,你自己要

RabbitMQ Performance Testing Tool 性能测试工具

RabbitMQ Performance Testing Tool 介绍:https://www.rabbitmq.com/java-tools.html RabbitMQ Performance Testing Tool 下载:https://github.com/rabbitmq/rabbitmq-perf-test/releases 解压文件(放到 RabbitMQ 安装目录下) rabbitmq-perf-test-1.1.0.zip 测试(命令行执行): > cd D:\Program