Skip to content

Commit 821769c

Browse files
authored
Docs: Add metrics and configs for embedded kill tasks (#18124)
Docs changes for #18028 - Document metrics and configs for embedded kill tasks - Remove duplicate configs for Coordinator auto-kill from `data-management/delete.md` - Fix up references
1 parent a352190 commit 821769c

6 files changed

Lines changed: 75 additions & 25 deletions

File tree

docs/api-reference/tasks-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,7 @@ Content-Length: 134
16011601

16021602
Manually clean up pending segments table in metadata storage for `datasource`. It returns a JSON object response with
16031603
`numDeleted` for the number of rows deleted from the pending segments table. This API is used by the
1604-
`druid.coordinator.kill.pendingSegments.on` [Coordinator setting](../configuration/index.md#coordinator-operation)
1604+
`druid.coordinator.kill.pendingSegments.on` [Coordinator setting](../configuration/index.md#data-management)
16051605
which automates this operation to perform periodically.
16061606

16071607
#### URL

docs/configuration/index.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -878,9 +878,19 @@ These Coordinator static configurations can be defined in the `coordinator/runti
878878
|Property|Description|Default|
879879
|--------|-----------|-------|
880880
|`druid.coordinator.period`|The run period for the Coordinator. The Coordinator operates by maintaining the current state of the world in memory and periodically looking at the set of "used" segments and segments being served to make decisions about whether any changes need to be made to the data topology. This property sets the delay between each of these runs.|`PT60S`|
881-
|`druid.coordinator.period.indexingPeriod`|How often to send compact/merge/conversion tasks to the indexing service. It's recommended to be longer than `druid.manager.segments.pollDuration`|`PT1800S` (30 mins)|
882881
|`druid.coordinator.startDelay`|The operation of the Coordinator works on the assumption that it has an up-to-date view of the state of the world when it runs, the current ZooKeeper interaction code, however, is written in a way that doesn’t allow the Coordinator to know for a fact that it’s done loading the current state of the world. This delay is a hack to give it enough time to believe that it has all the data.|`PT300S`|
883882
|`druid.coordinator.load.timeout`|The timeout duration for when the Coordinator assigns a segment to a Historical service.|`PT15M`|
883+
|`druid.coordinator.balancer.strategy`|The [balancing strategy](../design/coordinator.md#balancing-segments-in-a-tier) used by the Coordinator to distribute segments among the Historical servers in a tier. The `cost` strategy distributes segments by minimizing a cost function, `diskNormalized` weights these costs with the disk usage ratios of the servers and `random` distributes segments randomly.|`cost`|
884+
|`druid.coordinator.loadqueuepeon.http.repeatDelay`|The start and repeat delay (in milliseconds) for the load queue peon, which manages the load/drop queue of segments for any server.|1 minute|
885+
|`druid.coordinator.loadqueuepeon.http.batchSize`|Number of segment load/drop requests to batch in one HTTP request. Note that it must be smaller than or equal to the `druid.segmentCache.numLoadingThreads` config on Historical service. If this value is not configured, the coordinator uses the value of the `numLoadingThreads` for the respective server. | `druid.segmentCache.numLoadingThreads` |
886+
|`druid.coordinator.asOverlord.enabled`|Boolean value for whether this Coordinator service should act like an Overlord as well. This configuration allows users to simplify a Druid cluster by not having to deploy any standalone Overlord services. If set to true, then Overlord console is available at `http://coordinator-host:port/console.html` and be sure to set `druid.coordinator.asOverlord.overlordService` also.|false|
887+
|`druid.coordinator.asOverlord.overlordService`| Required, if `druid.coordinator.asOverlord.enabled` is `true`. This must be same value as `druid.service` on standalone Overlord services and `druid.selectors.indexing.serviceName` on Middle Managers.|NULL|
888+
889+
##### Data management
890+
891+
|Property|Description|Default|
892+
|--------|-----------|-------|
893+
|`druid.coordinator.period.indexingPeriod`|Period to run data management duties on the Coordinator including launching compact tasks and performing clean up of unused data. It is recommended to keep this value longer than `druid.manager.segments.pollDuration`.|`PT1800S` (30 mins)|
884894
|`druid.coordinator.kill.pendingSegments.on`|Boolean flag for whether or not the Coordinator clean up old entries in the `pendingSegments` table of metadata store. If set to true, Coordinator will check the created time of most recently complete task. If it doesn't exist, it finds the created time of the earliest running/pending/waiting tasks. Once the created time is found, then for all datasources not in the `killPendingSegmentsSkipList` (see [Dynamic configuration](#dynamic-configuration)), Coordinator will ask the Overlord to clean up the entries 1 day or more older than the found created time in the `pendingSegments` table. This will be done periodically based on `druid.coordinator.period.indexingPeriod` specified.|true|
885895
|`druid.coordinator.kill.on`|Boolean flag to enable the Coordinator to submit a kill task for unused segments and delete them permanently from the metadata store and deep storage.|false|
886896
|`druid.coordinator.kill.period`| The frequency of sending kill tasks to the indexing service. The value must be greater than or equal to `druid.coordinator.period.indexingPeriod`. Only applies if kill is turned on.|Same as `druid.coordinator.period.indexingPeriod`|
@@ -889,11 +899,6 @@ These Coordinator static configurations can be defined in the `coordinator/runti
889899
|`druid.coordinator.kill.bufferPeriod`|The amount of time that a segment must be unused before it is able to be permanently removed from metadata and deep storage. This can serve as a buffer period to prevent data loss if data ends up being needed after being marked unused.|`P30D`|
890900
|`druid.coordinator.kill.maxSegments`|The number of unused segments to kill per kill task. This number must be greater than 0. This only applies when `druid.coordinator.kill.on=true`.|100|
891901
|`druid.coordinator.kill.maxInterval`|The largest interval, as an [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations), of segments to delete per kill task. Set to zero, e.g. `PT0S`, for unlimited. This only applies when `druid.coordinator.kill.on=true`.|`P30D`|
892-
|`druid.coordinator.balancer.strategy`|The [balancing strategy](../design/coordinator.md#balancing-segments-in-a-tier) used by the Coordinator to distribute segments among the Historical servers in a tier. The `cost` strategy distributes segments by minimizing a cost function, `diskNormalized` weights these costs with the disk usage ratios of the servers and `random` distributes segments randomly.|`cost`|
893-
|`druid.coordinator.loadqueuepeon.http.repeatDelay`|The start and repeat delay (in milliseconds) for the load queue peon, which manages the load/drop queue of segments for any server.|1 minute|
894-
|`druid.coordinator.loadqueuepeon.http.batchSize`|Number of segment load/drop requests to batch in one HTTP request. Note that it must be smaller than or equal to the `druid.segmentCache.numLoadingThreads` config on Historical service. If this value is not configured, the coordinator uses the value of the `numLoadingThreads` for the respective server. | `druid.segmentCache.numLoadingThreads` |
895-
|`druid.coordinator.asOverlord.enabled`|Boolean value for whether this Coordinator service should act like an Overlord as well. This configuration allows users to simplify a Druid cluster by not having to deploy any standalone Overlord services. If set to true, then Overlord console is available at `http://coordinator-host:port/console.html` and be sure to set `druid.coordinator.asOverlord.overlordService` also.|false|
896-
|`druid.coordinator.asOverlord.overlordService`| Required, if `druid.coordinator.asOverlord.enabled` is `true`. This must be same value as `druid.service` on standalone Overlord services and `druid.selectors.indexing.serviceName` on Middle Managers.|NULL|
897902

898903
##### Metadata management
899904

@@ -1187,6 +1192,16 @@ The following properties pertain to segment metadata caching on the Overlord tha
11871192
|`druid.manager.segments.useIncrementalCache`|Denotes the usage mode of the segment metadata incremental cache. Possible modes are: (a) `never`: Cache is disabled. (b) `always`: Reads are always done from the cache. Service start-up will be blocked until cache has synced with the metadata store at least once. Transactions will block until cache has synced with the metadata store at least once after becoming leader. (c) `ifSynced`: Reads are done from the cache only if it has already synced with the metadata store. This mode does not block service start-up or transactions.|`never`|
11881193
|`druid.manager.segments.pollDuration`|Duration (in ISO 8601 format) between successive syncs of the cache with the metadata store. This property is used only when `druid.manager.segments.useIncrementalCache` is set to `always` or `ifSynced`.|`PT1M` (1 minute)|
11891194

1195+
##### Auto-kill unused segments (Experimental)
1196+
1197+
These configs pertain to the new embedded mode of running [kill tasks on the Overlord](../data-management/delete.md#auto-kill-data-on-the-overlord-experimental).
1198+
None of the configs that apply to [auto-kill performed by the Coordinator](../data-management/delete.md#auto-kill-data-using-coordinator-duties) are used by this feature.
1199+
1200+
|Property|Description|Default|
1201+
|--------|-----------|-------|
1202+
|`druid.manager.segments.killUnused.enabled`|Boolean flag to enable auto-kill of eligible unused segments on the Overlord. This feature can be used only when [segment metadata caching](#segment-metadata-cache-experimental) is enabled on the Overlord and MUST NOT be enabled if `druid.coordinator.kill.on` is already set to `true` on the Coordinator.|`true`|
1203+
|`druid.manager.segments.killUnused.bufferPeriod`|Period after which a segment marked as unused becomes eligible for auto-kill on the Overlord. This config is effective only if `druid.manager.segments.killUnused.enabled` is set to `true`.|`P30D` (30 days)|
1204+
11901205
#### Overlord dynamic configuration
11911206

11921207
The Overlord has dynamic configurations to tune how Druid assigns tasks to workers.

docs/data-management/automatic-compaction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ For more details on each of the specs in an auto-compaction configuration, see [
8585

8686
## Auto-compaction using Coordinator duties
8787

88-
You can control how often the Coordinator checks to see if auto-compaction is needed. The Coordinator [indexing period](../configuration/index.md#coordinator-operation), `druid.coordinator.period.indexingPeriod`, controls the frequency of compaction tasks.
88+
You can control how often the Coordinator checks to see if auto-compaction is needed. The Coordinator [indexing period](../configuration/index.md#data-management), `druid.coordinator.period.indexingPeriod`, controls the frequency of compaction tasks.
8989
The default indexing period is 30 minutes, meaning that the Coordinator first checks for segments to compact at most 30 minutes from when auto-compaction is enabled.
9090
This time period also affects other Coordinator duties such as cleanup of unused segments and stale pending segments.
9191
To configure the auto-compaction time period without interfering with `indexingPeriod`, see [Set frequency of compaction runs](#change-compaction-frequency).

docs/data-management/delete.md

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ title: "Data deletion"
2222
~ under the License.
2323
-->
2424

25-
## By time range, manually
25+
## Delete data for a time range manually
2626

2727
Apache Druid stores data [partitioned by time chunk](../design/storage.md) and supports
2828
deleting data for time chunks by dropping segments. This is a fast, metadata-only operation.
@@ -42,17 +42,17 @@ For documentation on disabling segments using the Coordinator API, see the
4242

4343
A data deletion tutorial is available at [Tutorial: Deleting data](../tutorials/tutorial-delete-data.md).
4444

45-
## By time range, automatically
45+
## Delete data automatically using drop rules
4646

4747
Druid supports [load and drop rules](../operations/rule-configuration.md), which are used to define intervals of time
4848
where data should be preserved, and intervals where data should be discarded. Data that falls under a drop rule is
49-
marked unused, in the same manner as if you [manually mark that time range unused](#by-time-range-manually). This is a
49+
marked unused, in the same manner as if you [manually mark that time range unused](#delete-data-for-a-time-range-manually). This is a
5050
fast, metadata-only operation.
5151

5252
Data that is dropped in this way is marked unused, but remains in deep storage. To permanently delete it, use a
5353
[`kill` task](#kill-task).
5454

55-
## Specific records
55+
## Delete specific records
5656

5757
Druid supports deleting specific records using [reindexing](update.md#reindex) with a filter. The filter specifies which
5858
data remains after reindexing, so it must be the inverse of the data you want to delete. Because segments must be
@@ -74,15 +74,15 @@ used to filter, modify, or enrich the data during the reindexing job.
7474
Data that is deleted in this way is marked unused, but remains in deep storage. To permanently delete it, use a [`kill`
7575
task](#kill-task).
7676

77-
## Entire table
77+
## Delete an entire table
7878

79-
Deleting an entire table works the same way as [deleting part of a table by time range](#by-time-range-manually). First,
79+
Deleting an entire table works the same way as [deleting part of a table by time range](#delete-data-for-a-time-range-manually). First,
8080
mark all segments unused using the Coordinator API or web console. Then, optionally, delete it permanently using a
8181
[`kill` task](#kill-task).
8282

8383
<a name="kill-task"></a>
8484

85-
## Permanently (`kill` task)
85+
## Delete data permanently using `kill` tasks
8686

8787
Data that has been overwritten or soft-deleted still remains as segments that have been marked unused. You can use a
8888
`kill` task to permanently delete this data.
@@ -116,3 +116,33 @@ Some of the parameters used in the task payload are further explained below:
116116
**WARNING:** The `kill` task permanently removes all information about the affected segments from the metadata store and
117117
deep storage. This operation cannot be undone.
118118

119+
### Auto-kill data using Coordinator duties
120+
121+
Instead of submitting `kill` tasks manually to permanently delete data for a given interval, you can enable auto-kill of unused segments on the Coordinator.
122+
The Coordinator runs a duty periodically to identify intervals containing unused segments that are eligible for kill. It then launches a `kill` task for each of these intervals.
123+
124+
Refer to [Data management on the Coordinator](../configuration/index.md#data-management) to configure auto-kill of unused segments on the Coordinator.
125+
126+
### Auto-kill data on the Overlord (Experimental)
127+
128+
:::info
129+
This is an experimental feature that:
130+
- Can be used only if [segment metadata caching](../configuration/index.md#segment-metadata-cache-experimental) is enabled on the Overlord.
131+
- MUST NOT be used if auto-kill of unused segments is already enabled on the Coordinator.
132+
:::
133+
134+
This is an experimental feature to run kill tasks in an "embedded" mode on the Overlord itself.
135+
136+
These embedded tasks offer several advantages over auto-kill performed by the Coordinator as they:
137+
- avoid a lot of unnecessary REST API calls to the Overlord from tasks or the Coordinator.
138+
- kill unused segments as soon as they become eligible.
139+
- run on the Overlord and do not take up task slots.
140+
- finish faster as they save on the overhead of launching a task process.
141+
- kill a small number of segments per task, to ensure that locks on an interval are not held for too long.
142+
- skip locked intervals to avoid head-of-line blocking in kill tasks.
143+
- require little to no configuration.
144+
- can keep up with a large number of unused segments in the cluster.
145+
- take advantage of the segment metadata cache on the Overlord.
146+
147+
Refer to [Auto-kill unused segments on the Overlord](../configuration/index.md#auto-kill-unused-segments-experimental) to configure auto-kill of unused segments on the Overlord.
148+
See [Auto-kill metrics](../operations/metrics.md#auto-kill-unused-segments) for the metrics emitted by embedded kill tasks.

docs/operations/clean-metadata-store.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,7 @@ Segment records and segments in deep storage become eligible for deletion when b
7979
- When they meet the eligibility requirement of kill task datasource configuration according to `killDataSourceWhitelist` set in the Coordinator dynamic configuration. See [Dynamic configuration](../configuration/index.md#dynamic-configuration).
8080
- When the `durationToRetain` time has passed since their creation.
8181

82-
Kill tasks use the following configuration:
83-
- `druid.coordinator.kill.on`: When `true`, enables the Coordinator to submit a kill task for unused segments, which deletes them completely from metadata store and from deep storage.
84-
Only applies to the specified datasources in the dynamic configuration parameter `killDataSourceWhitelist`.
85-
If `killDataSourceWhitelist` is not set or empty, then kill tasks can be submitted for all datasources.
86-
- `druid.coordinator.kill.period`: Defines the frequency in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601#Durations) for the cleanup job to check for and delete eligible segments. Defaults to `druid.coordinator.period.indexingPeriod`. Must be greater than or equal to `druid.coordinator.period.indexingPeriod`.
87-
- `druid.coordinator.kill.durationToRetain`: Defines the retention period in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601#Durations) after creation that segments become eligible for deletion.
88-
- `druid.coordinator.kill.ignoreDurationToRetain`: A way to override `druid.coordinator.kill.durationToRetain`. When enabled, the coordinator considers all unused segments as eligible to be killed.
89-
- `druid.coordinator.kill.bufferPeriod`: Defines the amount of time that a segment must be unused before it can be permanently removed from metadata and deep storage. This serves as a buffer period to prevent data loss if data ends up being needed after being marked unused.
90-
- `druid.coordinator.kill.maxSegments`: Defines the maximum number of segments to delete per kill task.
91-
- `druid.coordinator.kill.maxInterval`: Defines the largest interval, as an [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations), of segments to delete per kill task. Set to zero, e.g. `PT0S`, for unlimited.
82+
Refer to [Data Management on Coordinator](../configuration/index.md#data-management) to configure auto-kill of unused segments on the Coordinator.
9283

9384
### Audit records
9485

docs/operations/metrics.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,20 @@ The following metrics are emitted only when [segment metadata caching](../config
354354
|`segment/metadataCache/pending/updated`|Number of pending segments updated in the cache during the latest sync.|`dataSource`|
355355
|`segment/metadataCache/pending/skipped`|Number of unparseable pending segment records that were skipped in the latest sync.|`dataSource`|
356356

357+
### Auto-kill unused segments
358+
359+
These metrics are emitted only if [auto-kill of unused segments](../data-management/delete.md#auto-kill-data-on-the-overlord-experimental) is enabled on the Overlord.
360+
361+
|Metric|Description|Dimensions|
362+
|------|-----------|----------|
363+
|`segment/killed/metadataStore/count`|Number of segments permanently deleted from the metadata store.|`taskId`, `groupId`, `taskType`(=`kill`), `dataSource`|
364+
|`segment/killed/deepStorage/count`|Number of segments permanently deleted from the deep storage.|`taskId`, `groupId`, `taskType`(=`kill`), `dataSource`|
365+
|`segment/kill/unusedIntervals/count`|Number of intervals containing unused segments for a given datasource.|`dataSource`|
366+
|`segment/kill/skippedIntervals/count`|Number of intervals that were skipped for kill due to being already locked by another task.|`taskId`, `groupId`, `taskType`(=`kill`), `dataSource`|
367+
|`segment/kill/queueReset/time`|Time taken in milliseconds to reset the kill queue.||
368+
|`segment/kill/queueProcess/time`|Time taken in milliseconds to fully process the kill queue.||
369+
|`segment/kill/jobsProcessed/count`|Number of jobs processed from the kill queue for a given datasource.|`dataSource`|
370+
357371
## Shuffle metrics (Native parallel task)
358372

359373
The shuffle metrics can be enabled by adding `org.apache.druid.indexing.worker.shuffle.ShuffleMonitor` in `druid.monitoring.monitors`.

0 commit comments

Comments
 (0)