【问题标题】:Elasticsearch response time - strange valuesElasticsearch 响应时间 - 奇怪的值
【发布时间】:2016-11-05 05:47:25
【问题描述】:

我正在使用门牌号数据查询简单的 Elasticsearch 索引。

".house-numbers": {
    "mappings": {
      "house-number": {
        "properties": {
          "id": {
            "type": "keyword"
          },
          "value": {
            "type": "text",
            "index_options": "docs"
          }
        }
      }
    }
  }

然后我查询 POST http 请求之类的数据

请求网址

http://localhost:9200/.house-numbers/housenumber/_search

标题:

Content-Type: text/plain
Content-Length: 55
Accept: */*
Accept-Encoding: gzip, deflate, br

请求正文:

{
  "size": 30,
  "query": {
    "match": {
      "value": {
        "query": "2 3"
      }
    }
  }
}

请求在 10 毫秒 - 30 毫秒内返回数据,一切正常。 Elasticsearch 响应参数在所有情况下都是 3-5 毫秒。

当我将请求正文中的大小更改为 "size": 35 时,响应时间突然变为 500 毫秒。从 Elasticsearch 中获取的参数是相同的。没有特殊字符,响应的大小非常相似。

我尝试了许多客户端 NEST、Postman、Fiddler 来执行这些请求,每个客户端都有相同的行为。

我的 elasticsearch 的设置只包含

http.compression : true
http.compression_level : 9

我的 jvm 的设置

"jvm": {
  "timestamp": 1478108615141,
  "uptime_in_millis": 17150141,
  "mem": {
    "heap_used_in_bytes": 1384307624,
    "heap_used_percent": 66,
    "heap_committed_in_bytes": 2077753344,
    "heap_max_in_bytes": 2077753344,
    "non_heap_used_in_bytes": 96403904,
    "non_heap_committed_in_bytes": 101502976,
    "pools": {
      "young": {
        "used_in_bytes": 324358632,
        "max_in_bytes": 558432256,
        "peak_used_in_bytes": 558432256,
        "peak_max_in_bytes": 558432256
      },
      "survivor": {
        "used_in_bytes": 69730304,
        "max_in_bytes": 69730304,
        "peak_used_in_bytes": 69730304,
        "peak_max_in_bytes": 69730304
      },
      "old": {
        "used_in_bytes": 990220848,
        "max_in_bytes": 1449590784,
        "peak_used_in_bytes": 1190046816,
        "peak_max_in_bytes": 1449590784
      }...

我尝试了不同版本的 elasticsearch 我尝试了不同的设置 - 关闭 http.compression,更改 compression_level 我为 elasticsearch 尝试了另一个主机

我不知道是什么导致了这个问题,我无法继续我的工作。 知道在哪里寻找或如何进行吗?

【问题讨论】:

  • 如果您运行该查询 10-20 次,它会变得更快吗? ElasticSearch 会根据需要自动将数据移入和移出缓存,因此有时第一次查询很慢,但后续查询非常快。
  • 另外,您在 JVM 上固定了多少内存? [在此处获取该信息] (stackoverflow.com/questions/32100072/…)
  • @jhilden 请求后并没有变得更快,但有时一个请求会持续,例如8 毫秒,然后 10 个请求持续 500 毫秒。
  • @jhilden 我在问题中添加了 JVM 设置
  • 尝试在查询中使用Profile API 以获取有关执行的更多信息

标签: elasticsearch


【解决方案1】:

当然问题不在于elasticsearch,而在于http通信,尤其是开启http压缩时

消除延迟的提示

  • 关闭提琴手
  • 禁用防火墙和防病毒软件
  • 关闭所有可能拦截 http 通信的程序

【讨论】:

    猜你喜欢
    • 2015-08-17
    • 2014-08-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-28
    • 2011-03-27
    • 2020-08-10
    • 2013-01-04
    相关资源
    最近更新 更多