Elasticsearch负载测试期间的高CPU使用率(50 req / sec)

时间:2015-10-21 21:29:21

标签: elasticsearch cpu-usage

我在弹性搜索方面遇到了一些麻烦。

目前:

我的机器规格如下

  • CPU供应商:英特尔
  • CPU型号:Xeon(2001 MHz)
  • CPU总逻辑核心数:24
  • CPU缓存:15kb

  • VM名称:Java HotSpot(TM)64位服务器VM

  • VM供应商:Oracle Corporation
  • VM版本:25.31-b07
  • Java版本:1.8.0_31

elasticsearch v / 1.3.2

我的索引(metadatav3)包含:

映射

{
  "metadatav3": {
    "mappings": {
      "track": {
        "dynamic": "true",
        "numeric_detection": true,
        "properties": {
          "album.album": {
            "type": "string",
            "norms": {
              "enabled": false
            },
            "analyzer": "music_field"
          },
          "album.exact": {
            "type": "string",
            "analyzer": "exact_music_field"
          },
          "artist.artist": {
            "type": "string",
            "norms": {
              "enabled": false
            },
            "analyzer": "music_field"
          },
          "artist.exact": {
            "type": "string",
            "analyzer": "exact_music_field"
          },
          "fullString": {
            "type": "string",
            "norms": {
              "enabled": false
            },
            "analyzer": "nGram_token_field"
          },
          "fullString.token": {
            "type": "string",
            "norms": {
              "enabled": false
            },
            "analyzer": "music_field"
          },
          "id": {
            "type": "string"
          },
          "isHidden": {
            "type": "boolean"
          },
          "lastRankedDate": {
            "type": "long"
          },
          "popularity": {
            "type": "float"
          },
          "tagCount": {
            "type": "long"
          },
          "title.edgeNGNoSplit": {
            "type": "string",
            "norms": {
              "enabled": false
            },
            "analyzer": "edge_nGram_no_split_small_field"
          },
          "title.exact": {
            "type": "string",
            "analyzer": "exact_music_field"
          },
          "title.title": {
            "type": "string",
            "norms": {
              "enabled": false
            },
            "analyzer": "music_field"
          }
        }
      }
    }
  }
}

当我运行该查询时:

{
  "from": 0,
  "size": 20,
  "timeout": 5000,
  "query": {
    "function_score": {
      "query": {
        "bool": {
          "must": {
            "match": {
              "fullString": {
                "query": "test",
                "type": "boolean",
                "operator": "OR",
                "minimum_should_match": "1",
                "cutoff_frequency": 0.01
              }
            }
          },
          "must_not": {
            "term": {
              "isHidden": "true"
            }
          },
          "should": []
        }
      },
      "field_value_factor": {
        "field": "popularity"
      }
    }
  },
  "explain": false
}

接近50-60 req / sec的搜索响应时间变为60ms到4-5秒。

但是,当我运行该查询时:

{
  "from": 0,
  "size": 20,
  "timeout": 5000,
  "query": {
    "function_score": {
      "query": {
        "bool": {
          "must": {
            "match": {
              "fullString.token": {
                "query": "test",
                "type": "boolean",
                "operator": "OR",
                "minimum_should_match": "1",
                "cutoff_frequency": 0.01
              }
            }
          },
          "must_not": {
            "term": {
              "isHidden": "true"
            }
          },
          "should": []
        }
      },
      "field_value_factor": {
        "field": "popularity"
      }
    }
  },
  "explain": false
}

在负载测试期间我可以看到600 req / sec。

我的意思是我不明白使用ngram过滤器的部分可以创建那么多的cpu用法吗?

热线程转储如下:http://pastebin.com/5sFEZJa5 我也可以发送/上传bigdesk截图。

感谢。

0 个答案:

没有答案