Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Response Ops][Task Manager] Setting background task utilization window based on poll interval #203481

Merged
merged 9 commits into from
Jan 7, 2025

Conversation

ymao1
Copy link
Contributor

@ymao1 ymao1 commented Dec 9, 2024

Summary

Setting a desired window length (15 seconds) for the background task utilization window running average and calcuating the number of entries to average based on the poll interval. Updating config to be optional so this value can still be configured but if not configured will be calculated.

To Verify

  • Add a console log to log the window size
--- a/x-pack/platform/plugins/shared/task_manager/server/monitoring/background_task_utilization_statistics.ts
+++ b/x-pack/platform/plugins/shared/task_manager/server/monitoring/background_task_utilization_statistics.ts
@@ -59,6 +59,7 @@ export function createBackgroundTaskUtilizationAggregator(
     workerUtilizationRunningAverageWindowSize ??
     WORKER_UTILIZATION_RUNNING_AVERAGE_WINDOW_SIZE_MS / pollInterval;

+  console.log(`workerUtilizationWindowSize ${workerUtilizationWindowSize}`);
   const taskRunEventToAdhocStat = createTaskRunEventToAdhocStat();
   const taskRunAdhocEvents$: Observable<Pick<BackgroundTaskUtilizationStat, 'adhoc'>> =
  • Start Kibana with mget claim strategy. The window size should be 30
  • Start Kibana with update_by_query claim strategy. The window size should be 5
  • Set xpack.task_manager.worker_utilization_running_average_window: 22 in your Kibana config and start Kibana. The window size should be 22 (takes the configured window size if it's passed in).

@ymao1 ymao1 self-assigned this Dec 9, 2024
@ymao1 ymao1 added release_note:skip Skip the PR/issue when compiling release notes Feature:Task Manager Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v9.0.0 v8.18.0 backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Dec 9, 2024
@ymao1
Copy link
Contributor Author

ymao1 commented Dec 9, 2024

@elasticmachine merge upstream

@ymao1
Copy link
Contributor Author

ymao1 commented Dec 10, 2024

@elasticmachine merge upstream

@ymao1 ymao1 marked this pull request as ready for review December 10, 2024 13:29
@ymao1 ymao1 requested a review from a team as a code owner December 10, 2024 13:29
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@ymao1
Copy link
Contributor Author

ymao1 commented Dec 16, 2024

@elasticmachine merge upstream

Copy link
Contributor

@mikecote mikecote left a comment

Choose a reason for hiding this comment

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

Changes LGTM!

@ymao1
Copy link
Contributor Author

ymao1 commented Jan 6, 2025

@elasticmachine merge upstream

@ymao1
Copy link
Contributor Author

ymao1 commented Jan 6, 2025

@elasticmachine merge upstream

@ymao1 ymao1 added the ci:project-deploy-security Create a Security Serverless Project label Jan 6, 2025
@ymao1
Copy link
Contributor Author

ymao1 commented Jan 6, 2025

@elasticmachine merge upstream

@ymao1
Copy link
Contributor Author

ymao1 commented Jan 6, 2025

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

There are no new commits on the base branch.

@ymao1
Copy link
Contributor Author

ymao1 commented Jan 6, 2025

/ci

@ymao1
Copy link
Contributor Author

ymao1 commented Jan 7, 2025

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

elasticmachine commented Jan 7, 2025

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @ymao1

@ymao1
Copy link
Contributor Author

ymao1 commented Jan 7, 2025

Compared the metrics between a vanilla QA deployment and a deployment from this PR with 200 detection rules running at 5 minute intervals

Vanilla QA deployment (with the small window size)
Screenshot 2025-01-07 at 11 11 23 AM

PR deployment (with the correct window size)
Screenshot 2025-01-07 at 11 11 57 AM

We can see the smaller window size makes the deployment too reactive and overscales

@ymao1 ymao1 merged commit a82a02e into elastic:main Jan 7, 2025
8 checks passed
@ymao1 ymao1 deleted the background_task_utilization_window branch January 7, 2025 16:13
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/12654987867

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 7, 2025
…ow based on poll interval (elastic#203481)

## Summary

Setting a desired window length (15 seconds) for the background task
utilization window running average and calcuating the number of entries
to average based on the poll interval. Updating config to be optional so
this value can still be configured but if not configured will be
calculated.

## To Verify

- Add a console log to log the window size

```
--- a/x-pack/platform/plugins/shared/task_manager/server/monitoring/background_task_utilization_statistics.ts
+++ b/x-pack/platform/plugins/shared/task_manager/server/monitoring/background_task_utilization_statistics.ts
@@ -59,6 +59,7 @@ export function createBackgroundTaskUtilizationAggregator(
     workerUtilizationRunningAverageWindowSize ??
     WORKER_UTILIZATION_RUNNING_AVERAGE_WINDOW_SIZE_MS / pollInterval;

+  console.log(`workerUtilizationWindowSize ${workerUtilizationWindowSize}`);
   const taskRunEventToAdhocStat = createTaskRunEventToAdhocStat();
   const taskRunAdhocEvents$: Observable<Pick<BackgroundTaskUtilizationStat, 'adhoc'>> =
```

- Start Kibana with `mget` claim strategy. The window size should be 30
- Start Kibana with `update_by_query` claim strategy. The window size
should be 5
- Set `xpack.task_manager.worker_utilization_running_average_window: 22`
in your Kibana config and start Kibana. The window size should be 22
(takes the configured window size if it's passed in).

Co-authored-by: Elastic Machine <[email protected]>
(cherry picked from commit a82a02e)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jan 7, 2025
…n window based on poll interval (#203481) (#205782)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Response Ops][Task Manager] Setting background task utilization
window based on poll interval
(#203481)](#203481)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Ying
Mao","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-07T16:13:24Z","message":"[Response
Ops][Task Manager] Setting background task utilization window based on
poll interval (#203481)\n\n## Summary\r\n\r\nSetting a desired window
length (15 seconds) for the background task\r\nutilization window
running average and calcuating the number of entries\r\nto average based
on the poll interval. Updating config to be optional so\r\nthis value
can still be configured but if not configured will
be\r\ncalculated.\r\n\r\n## To Verify\r\n\r\n- Add a console log to log
the window size\r\n\r\n```\r\n---
a/x-pack/platform/plugins/shared/task_manager/server/monitoring/background_task_utilization_statistics.ts\r\n+++
b/x-pack/platform/plugins/shared/task_manager/server/monitoring/background_task_utilization_statistics.ts\r\n@@
-59,6 +59,7 @@ export function
createBackgroundTaskUtilizationAggregator(\r\n
workerUtilizationRunningAverageWindowSize ??\r\n
WORKER_UTILIZATION_RUNNING_AVERAGE_WINDOW_SIZE_MS /
pollInterval;\r\n\r\n+ console.log(`workerUtilizationWindowSize
${workerUtilizationWindowSize}`);\r\n const taskRunEventToAdhocStat =
createTaskRunEventToAdhocStat();\r\n const taskRunAdhocEvents$:
Observable<Pick<BackgroundTaskUtilizationStat, 'adhoc'>>
=\r\n```\r\n\r\n- Start Kibana with `mget` claim strategy. The window
size should be 30\r\n- Start Kibana with `update_by_query` claim
strategy. The window size\r\nshould be 5\r\n- Set
`xpack.task_manager.worker_utilization_running_average_window: 22`\r\nin
your Kibana config and start Kibana. The window size should be
22\r\n(takes the configured window size if it's passed
in).\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"a82a02e04335955fb9ad3e26e157b1debd6be0e0","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Feature:Task
Manager","Team:ResponseOps","v9.0.0","backport:prev-minor","ci:project-deploy-security","v8.18.0"],"title":"[Response
Ops][Task Manager] Setting background task utilization window based on
poll
interval","number":203481,"url":"https://github.com/elastic/kibana/pull/203481","mergeCommit":{"message":"[Response
Ops][Task Manager] Setting background task utilization window based on
poll interval (#203481)\n\n## Summary\r\n\r\nSetting a desired window
length (15 seconds) for the background task\r\nutilization window
running average and calcuating the number of entries\r\nto average based
on the poll interval. Updating config to be optional so\r\nthis value
can still be configured but if not configured will
be\r\ncalculated.\r\n\r\n## To Verify\r\n\r\n- Add a console log to log
the window size\r\n\r\n```\r\n---
a/x-pack/platform/plugins/shared/task_manager/server/monitoring/background_task_utilization_statistics.ts\r\n+++
b/x-pack/platform/plugins/shared/task_manager/server/monitoring/background_task_utilization_statistics.ts\r\n@@
-59,6 +59,7 @@ export function
createBackgroundTaskUtilizationAggregator(\r\n
workerUtilizationRunningAverageWindowSize ??\r\n
WORKER_UTILIZATION_RUNNING_AVERAGE_WINDOW_SIZE_MS /
pollInterval;\r\n\r\n+ console.log(`workerUtilizationWindowSize
${workerUtilizationWindowSize}`);\r\n const taskRunEventToAdhocStat =
createTaskRunEventToAdhocStat();\r\n const taskRunAdhocEvents$:
Observable<Pick<BackgroundTaskUtilizationStat, 'adhoc'>>
=\r\n```\r\n\r\n- Start Kibana with `mget` claim strategy. The window
size should be 30\r\n- Start Kibana with `update_by_query` claim
strategy. The window size\r\nshould be 5\r\n- Set
`xpack.task_manager.worker_utilization_running_average_window: 22`\r\nin
your Kibana config and start Kibana. The window size should be
22\r\n(takes the configured window size if it's passed
in).\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"a82a02e04335955fb9ad3e26e157b1debd6be0e0"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/203481","number":203481,"mergeCommit":{"message":"[Response
Ops][Task Manager] Setting background task utilization window based on
poll interval (#203481)\n\n## Summary\r\n\r\nSetting a desired window
length (15 seconds) for the background task\r\nutilization window
running average and calcuating the number of entries\r\nto average based
on the poll interval. Updating config to be optional so\r\nthis value
can still be configured but if not configured will
be\r\ncalculated.\r\n\r\n## To Verify\r\n\r\n- Add a console log to log
the window size\r\n\r\n```\r\n---
a/x-pack/platform/plugins/shared/task_manager/server/monitoring/background_task_utilization_statistics.ts\r\n+++
b/x-pack/platform/plugins/shared/task_manager/server/monitoring/background_task_utilization_statistics.ts\r\n@@
-59,6 +59,7 @@ export function
createBackgroundTaskUtilizationAggregator(\r\n
workerUtilizationRunningAverageWindowSize ??\r\n
WORKER_UTILIZATION_RUNNING_AVERAGE_WINDOW_SIZE_MS /
pollInterval;\r\n\r\n+ console.log(`workerUtilizationWindowSize
${workerUtilizationWindowSize}`);\r\n const taskRunEventToAdhocStat =
createTaskRunEventToAdhocStat();\r\n const taskRunAdhocEvents$:
Observable<Pick<BackgroundTaskUtilizationStat, 'adhoc'>>
=\r\n```\r\n\r\n- Start Kibana with `mget` claim strategy. The window
size should be 30\r\n- Start Kibana with `update_by_query` claim
strategy. The window size\r\nshould be 5\r\n- Set
`xpack.task_manager.worker_utilization_running_average_window: 22`\r\nin
your Kibana config and start Kibana. The window size should be
22\r\n(takes the configured window size if it's passed
in).\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"a82a02e04335955fb9ad3e26e157b1debd6be0e0"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Ying Mao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) ci:project-deploy-security Create a Security Serverless Project Feature:Task Manager release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants