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

Does it work with the JVM? #18

Open
danielepolencic opened this issue Jun 21, 2024 · 4 comments
Open

Does it work with the JVM? #18

danielepolencic opened this issue Jun 21, 2024 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@danielepolencic
Copy link

This is just a question.

Does memory pressure work with the JVM where the memory is allocated upfront?

@MathieuCesbron
Copy link
Contributor

Hello, thanks for the question.

I still have to check, I will update when I am sure of the answer.

@Terraris
Copy link

I have the same question :)

@MathieuCesbron
Copy link
Contributor

MathieuCesbron commented Aug 22, 2024

It looks like it works with the JVM, here is the test I made:

  1. Build a dummy java container with a minimum memory limit of 80m
FROM openjdk:17-jdk-alpine

WORKDIR /app

COPY Main.java /app/Main.java

RUN javac Main.java

CMD ["java", "-Xms80m", "Main"]
  1. Apply the container in a Pod with Kondense.
  2. Check that Kondense will still resize more than 80m
Screenshot 2024-08-22 at 11 01 47

We see that Kondense resizes it to 47Mib, below the 80M limit put in the Dockerfile.

@MathieuCesbron MathieuCesbron self-assigned this Aug 22, 2024
@MathieuCesbron MathieuCesbron added enhancement New feature or request question Further information is requested and removed enhancement New feature or request labels Aug 22, 2024
@danielepolencic
Copy link
Author

I'm not a Java expert, but I suspect this will not work. Since I filed the original issue, I did some research and garbage-collected languages expect the memory to be available to allocate objects on the heap. If the heap is "small", that leads to more frequent garbage collection, impacting performance.
Kondense can see memory utilization until that point, but I suspect the JVM could try to allocate more objects to the heap without triggering GC (because the heap is not full yet).
I guess it does not help that the Java app does nothing 😅
Again, I'm happy to be proven wrong, but I suspect this holds true for all garbage collected languages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants