Use the cold-search plugin

更新时间:
复制 MD 格式

In logging scenarios that use an OpenStore storage cluster, cold queries on hot-and-cold shared compute nodes can consume significant CPU and memory resources, which can degrade the performance of hot data queries. The cold-search plugin lets you limit CPU and memory resources for cold queries and apply circuit breaking, ensuring the stability of hot data queries.

Usage notes

The cold-search plugin is installed by default and cannot be uninstalled. You can view it on the plugin configuration page. To use this plugin, ensure the following conditions are met:

  • The instance version is 7.10.0 or later, and the kernel version is 1.6.0 or later.

  • For the data node instance family, select the hot-and-cold shared compute type.

Configure CPU limits

Run the following command to configure CPU resource limits for cold queries. The parameter values in the command are examples. For a detailed description and the default value of each parameter, see the table below.

PUT _cluster/settings
{
  "persistent":{
    "apack.cold_search.cpu.cold_max":0.7,
    "apack.cold_search.cpu.normal_share":1024,
    "apack.cold_search.cpu.cold_share":2
  }
}

Parameter

Type

Default

Description

apack.cold_search.cpu.cold_max

Float

0.7

The maximum proportion of CPU that cold queries can use per second on a single node.

For example, if a node has 4 CPU cores and this parameter is set to 0.5, cold queries can use up to 4 * 0.5 = 2 CPU cores per second.

apack.cold_search.cpu.normal_share

Integer

100

The CPU resource weight for non-cold queries. The minimum value is 2. This parameter works with apack.cold_search.cpu.cold_share to control the ratio of CPU resources between non-cold and cold queries. This setting takes effect only when the node's CPU utilization reaches 100%. For example, if apack.cold_search.cpu.normal_share is 90 and apack.cold_search.cpu.cold_share is 10, the ratio is 90:10. If non-cold queries use 50% of the CPU and cold queries use 40%, circuit breaking is not triggered because the total utilization (90%) is less than 100%.

apack.cold_search.cpu.cold_share

Integer

10

The CPU resource weight for cold queries. The minimum value is 2. This parameter works with apack.cold_search.cpu.normal_share to control the ratio of CPU resources between non-cold and cold queries.

Configure memory limits

Run the following command to configure memory resource limits for cold queries.

PUT _cluster/settings
{
  "persistent":{
      "apack.cold_search.mem.cold_max_percent": "80%",
      "apack.cold_search.mem.cold_delay_interval":"5s",
      "apack.cold_search.mem.jvm_max_percent": "90%",
      "apack.cold_search.mem.delay_interval": "2s"
  }
}

Parameter

Type

Default

Description

apack.cold_search.mem.cold_max_percent

Percentage or capacity unit

80%

The circuit breaking threshold for memory consumed by cold queries.

apack.cold_search.mem.cold_delay_interval

Time value

5s

The delay before circuit breaking is triggered once the memory usage of cold queries exceeds the threshold.

apack.cold_search.mem.jvm_max_percent

Percentage or capacity unit

90%

The circuit breaking threshold for total memory usage across all queries.

apack.cold_search.mem.delay_interval

Time value

2s

The delay before circuit breaking is triggered once the total memory usage for all queries exceeds the threshold.

Circuit breaking behavior

If a cold query exceeds the configured CPU or memory limits, Elasticsearch triggers circuit breaking. When circuit breaking is active, the system stops allocating additional CPU and memory resources to the cold query. This slows down the query but does not cause it to fail.