-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Refactor memory autoscaling decider into its own class (#89470)
This commit factors out the code that decides how much memory is required during an autoscale request into its own decider class. This prepares the ML autoscaling decider service to accommodate more deciders for processors and storage in the future.
- Loading branch information
1 parent
af4421d
commit fb4adda
Showing
9 changed files
with
2,616 additions
and
2,414 deletions.
There are no files selected for viewing
This file contains 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
998 changes: 23 additions & 975 deletions
998
.../ml/src/main/java/org/elasticsearch/xpack/ml/autoscaling/MlAutoscalingDeciderService.java
Large diffs are not rendered by default.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
.../ml/src/main/java/org/elasticsearch/xpack/ml/autoscaling/MlMemoryAutoscalingCapacity.java
This file contains 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,48 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.ml.autoscaling; | ||
|
||
import org.elasticsearch.common.unit.ByteSizeValue; | ||
import org.elasticsearch.xpack.autoscaling.capacity.AutoscalingCapacity; | ||
|
||
public record MlMemoryAutoscalingCapacity(ByteSizeValue nodeSize, ByteSizeValue tierSize, String reason) { | ||
|
||
public static Builder builder(ByteSizeValue nodeSize, ByteSizeValue tierSize) { | ||
return new Builder(nodeSize, tierSize); | ||
} | ||
|
||
public static Builder from(AutoscalingCapacity autoscalingCapacity) { | ||
return builder(autoscalingCapacity.node().memory(), autoscalingCapacity.total().memory()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "MlMemoryAutoscalingCapacity{" + "nodeSize=" + nodeSize + ", tierSize=" + tierSize + ", reason='" + reason + '\'' + '}'; | ||
} | ||
|
||
public static class Builder { | ||
|
||
private ByteSizeValue nodeSize; | ||
private ByteSizeValue tierSize; | ||
private String reason; | ||
|
||
public Builder(ByteSizeValue nodeSize, ByteSizeValue tierSize) { | ||
this.nodeSize = nodeSize; | ||
this.tierSize = tierSize; | ||
} | ||
|
||
public Builder setReason(String reason) { | ||
this.reason = reason; | ||
return this; | ||
} | ||
|
||
public MlMemoryAutoscalingCapacity build() { | ||
return new MlMemoryAutoscalingCapacity(nodeSize, tierSize, reason); | ||
} | ||
} | ||
} |
950 changes: 950 additions & 0 deletions
950
...n/ml/src/main/java/org/elasticsearch/xpack/ml/autoscaling/MlMemoryAutoscalingDecider.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Oops, something went wrong.