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

[AMORO-3451] Fix kubernetes optimizer pod is frequently being killed #3458

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Marvel-Gu
Copy link
Contributor

Why are the changes needed?

Close #3451.

Brief change log

In ams KubernetesOptimizerContainer, limit the size of the JVM heap memory to 80% of the pod's memory limit.

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible

  • Add screenshots for manual tests if appropriate

  • Run test locally before making a pull request

Documentation

  • Does this pull request introduce a new feature? no

@github-actions github-actions bot added the module:ams-server Ams server module label Mar 5, 2025
@Marvel-Gu
Copy link
Contributor Author

I didn't format the code😂, I'll pay attention next time.


if (resource.getMemoryMb() > 0) {
memory = resource.getMemoryMb();
} else {
memoryPerThread = Long.parseLong(checkAndGetProperty(groupProperties, MEMORY_PROPERTY));
memory = memoryPerThread * resource.getThreadCount();
}

// reserving 20% of total pod memory for JVM non-heap memory
jvmHeapMemory = (long) (memory * 0.8);
Copy link
Contributor

Choose a reason for hiding this comment

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

If we do not use off-heap memory in the code, I think it can be set to 0.9, which will not cause the container to be killed. If it is still frequently killed by OOM, we may need to check whether there is a memory leak in the code or the instantaneous Heap usage exceeds the container limit. We may be able to provide an external parameter for users to set, WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds great, I'll work on it.

@github-actions github-actions bot added the type:docs Improvements or additions to documentation label Mar 7, 2025
@Marvel-Gu Marvel-Gu force-pushed the fix-k8s-optimizer-jvmHeapMemery-size branch from 7bfe3c3 to c5c3e8e Compare March 10, 2025 20:16
@Marvel-Gu Marvel-Gu requested a review from czy006 March 11, 2025 10:14
@zhoujinsong
Copy link
Contributor

The default 80% configuration looks good to me. Maybe we can merge this PR now or do we have some other thing to validate before that? @Marvel-Gu @czy006

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:ams-server Ams server module type:docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Kubernetes optimizer pod is frequently being killed
3 participants