-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Replaced CPU load average logic with AverageTracker classes. Default thresholds modified #18666
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
Open
Harsh-87
wants to merge
15
commits into
opensearch-project:main
Choose a base branch
from
Harsh-87:staggeredmerge-fixes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
37fa621
Replaced CPU load average logic with AverageTracker classes. Default …
d0fd7eb
Replaced CPU load average logic with AverageTracker classes. Default …
94c8e4f
Merge branch 'main' into staggeredmerge-fixes
Harsh-87 3c4e687
Added java doc for github checks
3c92abf
[Bug Fix] Fix the backward compatibility regression with `COMPLEMENT`…
prudhvigodithi 21564e8
Fix bugs in replication lag computation (#18602)
mch2 7638df4
Fixed integration test
34ba425
Changelog fix, ResourceUsageTracker stop logic when feature is disabed
972b1bd
Added PR link to CHANGELOG, added tracker safety check in hasWarmNode…
8266882
Added PR link to CHANGELOG, added tracker safety check in hasWarmNode…
a61045d
Merge remote-tracking branch 'origin/staggeredmerge-fixes' into stagg…
2e3ce71
Fixed Tracker constant names
5094b7d
Fixed Tracker constant names
5d0223c
Merge remote-tracking branch 'origin/staggeredmerge-fixes' into stagg…
f72a516
Fixed gradle checks
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
server/src/main/java/org/opensearch/index/autoforcemerge/ResourceTrackerProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.index.autoforcemerge; | ||
|
||
import org.opensearch.common.unit.TimeValue; | ||
import org.opensearch.node.resource.tracker.AverageCpuUsageTracker; | ||
import org.opensearch.node.resource.tracker.AverageMemoryUsageTracker; | ||
import org.opensearch.threadpool.ThreadPool; | ||
|
||
/** | ||
* Provider for creating resource usage trackers used in auto force merge operations. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class ResourceTrackerProvider { | ||
Check warning on line 21 in server/src/main/java/org/opensearch/index/autoforcemerge/ResourceTrackerProvider.java
|
||
|
||
public static final TimeValue SHORT_POLL_INTERVAL = TimeValue.timeValueSeconds(6); | ||
public static final TimeValue LONG_POLL_INTERVAL = TimeValue.timeValueSeconds(30); | ||
public static final TimeValue SHORT_AVERAGE_WINDOW = TimeValue.timeValueMinutes(1); | ||
public static final TimeValue LONG_AVERAGE_WINDOW = TimeValue.timeValueMinutes(5); | ||
|
||
public static ResourceTrackers resourceTrackers; | ||
|
||
public static ResourceTrackers create(ThreadPool threadPool) { | ||
return resourceTrackers = new ResourceTrackers( | ||
Harsh-87 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
new AverageCpuUsageTracker(threadPool, SHORT_POLL_INTERVAL, SHORT_AVERAGE_WINDOW), | ||
new AverageCpuUsageTracker(threadPool, LONG_POLL_INTERVAL, LONG_AVERAGE_WINDOW), | ||
new AverageMemoryUsageTracker(threadPool, SHORT_POLL_INTERVAL, SHORT_AVERAGE_WINDOW), | ||
new AverageMemoryUsageTracker(threadPool, LONG_POLL_INTERVAL, LONG_AVERAGE_WINDOW) | ||
); | ||
} | ||
|
||
/** | ||
* Container for resource usage trackers used in auto force merge operations. | ||
* Provides access to CPU and JVM memory usage trackers with different time windows. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public static class ResourceTrackers { | ||
public final AverageCpuUsageTracker cpuOneMinute; | ||
public final AverageCpuUsageTracker cpuFiveMinute; | ||
public final AverageMemoryUsageTracker jvmOneMinute; | ||
public final AverageMemoryUsageTracker jvmFiveMinute; | ||
|
||
/** | ||
* Creates a new ResourceTrackers instance. | ||
* | ||
* @param cpuOneMinute CPU tracker with 1-minute window | ||
* @param cpuFiveMinute CPU tracker with 5-minute window | ||
* @param jvmOneMinute JVM memory tracker with 1-minute window | ||
* @param jvmFiveMinute JVM memory tracker with 5-minute window | ||
*/ | ||
ResourceTrackers( | ||
AverageCpuUsageTracker cpuOneMinute, | ||
AverageCpuUsageTracker cpuFiveMinute, | ||
AverageMemoryUsageTracker jvmOneMinute, | ||
AverageMemoryUsageTracker jvmFiveMinute | ||
) { | ||
this.cpuOneMinute = cpuOneMinute; | ||
this.cpuFiveMinute = cpuFiveMinute; | ||
this.jvmOneMinute = jvmOneMinute; | ||
this.jvmFiveMinute = jvmFiveMinute; | ||
} | ||
|
||
public void start() { | ||
cpuOneMinute.start(); | ||
cpuFiveMinute.start(); | ||
jvmOneMinute.start(); | ||
jvmFiveMinute.start(); | ||
} | ||
|
||
public void stop() { | ||
cpuOneMinute.stop(); | ||
cpuFiveMinute.stop(); | ||
jvmOneMinute.stop(); | ||
jvmFiveMinute.stop(); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.