Skip to content
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions _opensearch/cluster-manager-task-throttling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
layout: default
title: Cluster manager task throttling
nav_order: 70
has_children: false
---

# Cluster manager task throttling

For many cluster state updates, such as defining a mapping or creating an index, nodes submit tasks to the cluster manager. The cluster manager maintains a pending task queue for these tasks and runs them in a single-threaded environment. When nodes send tens of thousands of resource-intensive tasks, like `put-mapping` or snapshot tasks, these tasks pile up in the queue, and the cluster manager is flooded. This affects the cluster manager performance, and may in turn affect the availability of the whole cluster.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion only:
"When nodes send tens of thousands of resource-intensive tasks, like put-mapping or snapshot tasks, these tasks can pile up in the queue and flood the cluster manager."
"This affects cluster manager performance..."
or
"This affects the cluster manager's performance..."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good. I'll change. Thanks!


The first line of defense is to implement mechanisms in the caller nodes to avoid task overload on the cluster manager. However, even with those mechanisms in place, the cluster manager needs a built-in way to protect itself---cluster manager task throttling.
Comment thread
kolchfa-aws marked this conversation as resolved.
Outdated

To turn on cluster manager task throttling, you need to specify to throttle tasks by setting throttling limits. The cluster manager uses the throttling limits to determine whether to reject a task.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specify throttling tasks?


The cluster manager rejects tasks on the task type basis. For any incoming task, the cluster manager evaluates the total number of tasks of the same type in the pending task queue. If this number exceeds the threshold for this task type, the cluster manager rejects the incoming task. Rejecting a task does not affect tasks of a different type. For example, if the cluster manager rejects a `put-mapping` task, it can still accept a subsequent `create-index` task.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rejects tasks on the basis of task types?


When the cluster manager rejects a task, the node performs retries with exponential backoff to resubmit the task to the cluster manager. If retries are unsuccessful within the timeout period, OpenSearch returns a cluster timeout error.

## Setting throttling limits

You can set the throttling limits by specifying them in the `cluster_manager.throttling.thresholds` object and updating the [OpenSearch cluster settings]({{site.url}}{{site.baseurl}}/api-reference/cluster-settings). The setting is dynamic, so you can change the behavior of this feature without restarting your cluster.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set throttling limits?


By default, throttling is disabled for all task types.
{: .note}

The request has the following format:

```json
PUT _cluster/settings
{
"persistent": {
"cluster_manager.throttling.thresholds" : {
"<task-type>" : {
"value" : <threshold limit>
}
}
}
}
```

The following table describes the `cluster_manager.throttling.thresholds` object.

Field name | Description

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Field name | Description
Field Name | Description

:--- | :---
task-type | The task type. See [supported task types](#supported-task-types) for a list of valid values.
value | The maximum number of tasks of the type specified by the `task-type` in the cluster manager's pending task queue. Default is `-1` (no task throttling).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tasks of the task-type type specified by?


## Supported task types

The following task types are supported:

- `create-index`
- `update-settings`
- `cluster-update-settings`
- `auto-create`
- `delete-index`
- `delete-dangling-index`
- `create-data-stream`
- `remove-data-stream`
- `rollover-index`
- `index-aliases`
- `put-mapping`
- `create-index-template`
- `remove-index-template`
- `create-component-template`
- `remove-component-template`
- `create-index-template-v2`
- `remove-index-template-v2`
- `put-pipeline`
- `delete-pipeline`
- `create-persistent-task`
- `finish-persistent-task`
- `remove-persistent-task`
- `update-task-state`
- `put-script`
- `delete-script`
- `put-repository`
- `delete-repository`
- `create-snapshot`
- `delete-snapshot`
- `update-snapshot-state`
- `restore-snapshot`
- `cluster-reroute-api`

#### Sample request

The following request sets the throttling threshold for the `put-mapping` task type to 100:

```json
PUT _cluster/settings
{
"persistent": {
"cluster_manager.throttling.thresholds": {
"put-mapping": {
"value": 100
}
}
}
}
```

Set the threshold to `-1` to disable throttling for a task type.
{: .note}