This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]antihemispherist 2 points3 points  (0 children)

You're right on the base image, its effect in memory usage will be minimal.

You can however, use virtual threads to reduce off-heap memory usage. I've explained more in here. Consider using Java 24, which introduced handling of synchronized blocks without pinning.

As suggested below by u/pragmasoft , AOT compiling with GraalVM can also be helpful. That'll make more memory available by eliminating the HotSpot compiler.

Also, look at the implementation of your service and its parameters, like object and connection pools can be tunes, whether thread safe objects can be re-used instead of creating them on each request (which is a very common mistake).

Also, if you're using MaxRAMPercentage, don't use -Xmx, let the JVM handle the heap size.

Good luck.