Skip to content

[ML] Handle new actual_memory_usage_bytes field in model size stats. #126256

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
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

edsavage
Copy link
Contributor

@edsavage edsavage commented Apr 4, 2025

The actual_memory_usage_bytes field represents the real, physical memory allocated to the autodetect process as reported by the OS. Reporting this value in the model size stats associated with an AD job is useful, especially in OOM situations.

Relates elastic/ml-cpp#2846

The `actual_memory_usage_bytes` field represents the real, physical memory allocated to the `autodetect` process as reported by the OS. Reporting this value in the model size stats associated with an AD job is useful, especially in OOM situations.
@elasticsearchmachine
Copy link
Collaborator

Hi @edsavage, I've created a changelog YAML for you.

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/ml-core (Team:ML)

@edsavage edsavage requested a review from valeriy42 April 8, 2025 02:06
@edsavage
Copy link
Contributor Author

edsavage commented Apr 8, 2025

The new actual_memory_usage_bytes field can be seen in the screenshot below. It will require formatting by Kibana to represent its value in a manner similar to model_bytes, peak_model_bytes etc.

image

Copy link
Member

@davidkyle davidkyle left a comment

Choose a reason for hiding this comment

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

LGTM

Please can you add a test that the new field appears in the Get model stats API. Add it to this test


/**
* Reference to the most recent Ml config version.
* This should be the Ml config version with the highest id.
*/
public static final MlConfigVersion CURRENT = V_12;
public static final MlConfigVersion CURRENT = V_13;
Copy link
Member

Choose a reason for hiding this comment

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

Is the config version change necessary? Model size stats are considered to be a result type not a config type and are stored in the .ml-anomalies-x indices.

ModelSizeStats has 2 parsers; a strict parser that errors if it does not recognise a field and a lenient parser that ignores unknown fields. The strict parser is used reading the output from autodetect and the lenient is used reading the documents from Elasticsearch. This way in a mixed version cluster if a upgraded node stores the stats doc with the actual_memory_usage_bytes field then when an old node reads the doc it won't error when it sees the unknown actual_memory_usage_bytes field. This mechanism works well for backwards compatibility and means that most of the time versioning is not required.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TIL, Thanks Dave!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :ml Machine learning Team:ML Meta label for the ML team v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants